BRL-CAD
osg_bob.cpp
Go to the documentation of this file.
1 /* O S G . C P P
2  * BRL-CAD
3  *
4  * Copyright (c) 2011-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup libdm */
21 /** @{ */
22 /** @file libdm/osg.cpp
23  *
24  * An interface to OSG.
25  *
26  */
27 /** @} */
28 
29 #include "common.h"
30 
31 #include "ged.h"
32 #include "tk.h"
33 #include "solid.h"
34 #include "dm.h"
35 #include "dm_xvars.h"
36 #include "dm-ogl.h"
37 #include <assert.h>
38 
39 #if 1
40 #include <osgDB/ReadFile>
41 #include <osgDB/WriteFile>
42 #include <osgUtil/Optimizer>
43 #include <osg/CoordinateSystemNode>
44 
45 #include <osg/Switch>
46 #include <osgText/Text>
47 
48 #include <osgViewer/Viewer>
49 #include <osgViewer/ViewerEventHandlers>
50 
51 #include <osgGA/StandardManipulator>
52 #include <osgGA/TrackballManipulator>
53 #include <osgGA/FlightManipulator>
54 #include <osgGA/DriveManipulator>
55 #include <osgGA/KeySwitchMatrixManipulator>
56 #include <osgGA/StateSetManipulator>
57 #include <osgGA/AnimationPathManipulator>
58 #include <osgGA/TerrainManipulator>
59 #include <osgGA/SphericalManipulator>
60 
61 #include <iostream>
62 
63 #include <osg/TexGen>
64 #include <osg/Texture2D>
65 #include <osgViewer/api/X11/GraphicsWindowX11>
66 #include <osg/MatrixTransform>
67 #include <osg/ShapeDrawable>
68 
69 #else
70 #include <osg/Geode>
71 #include <osg/TexGen>
72 #include <osg/Texture2D>
73 
74 #include <osgViewer/Viewer>
75 #include <osgViewer/api/X11/GraphicsWindowX11>
76 #include <osgDB/ReadFile>
77 #include <osg/MatrixTransform>
78 #include <osg/ShapeDrawable>
79 #endif
80 
81 
83 void dm_osgInit(struct dm *dmp);
84 void dm_osgReshape(struct dm *dmp);
85 void dm_osgPaint(struct dm *dmp);
86 void dm_osgLoadMatrix(struct dm *dmp, matp_t mp);
88 
89 struct osg_stuff {
90  osg::ref_ptr<osgViewer::Viewer> viewer;
91  double left, right, bottom, top, near, far;
92  int prev_pflag;
93 };
94 
95 
96 /* Rim, body, lid, and bottom data must be reflected in x and
97  y; handle and spout data across the y axis only. */
98 
99 static int patchdata[][16] =
100 {
101  /* rim */
102  {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
103  /* body */
104  {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27},
105  {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40},
106  /* lid */
107  {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, 101, 0, 1, 2, 3,},
108  {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117},
109  /* bottom */
110  {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, 125, 120, 40, 39, 38, 37},
111  /* handle */
112  {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56},
113  {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 65, 66, 67},
114  /* spout */
115  {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83},
116  {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95}
117 };
118 /* *INDENT-OFF* */
119 
120 static float cpdata[][3] =
121 {
122  {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0,-0.2, 2.7},
123  {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, {0.749, -1.3375, 2.53125},
124  {0, -1.3375, 2.53125}, {1.4375,0, 2.53125}, {1.4375, -0.805, 2.53125},
125  {0.805, -1.4375, 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4},
126  {1.5, -0.84, 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875},
127  {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, 1.875}, {2, 0, 1.35},
128  {2, -1.12, 1.35}, {1.12, -2, 1.35}, {0, -2, 1.35}, {2, 0, 0.9},
129  {2, -1.12, 0.9}, {1.12, -2, 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45},
130  {2, -1.12, 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225},
131  {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, {1.5, 0, 0.15},
132  {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, -1.5, 0.15}, {-1.6, 0, 2.025},
133  {-1.6, -0.3, 2.025}, {-1.5,-0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025},
134  {-2.3, -0.3, 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, 2.025},
135  {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, 2.25}, {-2.7, 0, 1.8},
136  {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, {-3, 0, 1.8}, {-2.7, 0, 1.575},
137  {-2.7, -0.3, 1.575}, {-3, -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125},
138  {-2.5, -0.3, 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375},
139  {-2, -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, 1.425},
140  {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, 0.6}, {2.6, 0, 1.425},
141  {2.6, -0.66, 1.425}, {3.1, -0.66, 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1},
142  {2.3, -0.25, 2.1}, {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4},
143  {2.7, -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, 2.475},
144  {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, {3.525, 0, 2.49375},
145  {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, {3.45, -0.15, 2.5125},
146  {3.45, 0, 2.5125}, {2.8, 0, 2.4}, {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4},
147  {3.2, 0, 2.4}, {0, 0, 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15},
148  {0.45, -0.8, 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4},
149  {1.4, -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, 2.55},
150  {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, 2.55}, {1.3, 0, 2.55},
151  {1.3, -0.728, 2.55}, {0.728, -1.3, 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4},
152  {1.3, -0.728, 2.4}, {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0},
153  {1.425, -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, 0},
154  {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, {0.84, -1.5, 0.075}
155 };
156 
157 static float tex[2][2][2] =
158 {
159  { {0, 0},
160  {1, 0}},
161  { {0, 1},
162  {1, 1}}
163 };
164 
165 /* *INDENT-ON* */
166 
167  static void
168 teapot(GLint grid, GLenum type)
169 {
170  float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
171  long i, j, k, l;
172 
173  glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
174  glEnable(GL_AUTO_NORMAL);
175  glEnable(GL_NORMALIZE);
176  glEnable(GL_MAP2_VERTEX_3);
177  glEnable(GL_MAP2_TEXTURE_COORD_2);
178  for (i = 0; i < 10; i++) {
179  for (j = 0; j < 4; j++) {
180  for (k = 0; k < 4; k++) {
181  for (l = 0; l < 3; l++) {
182  p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
183  q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
184  if (l == 1)
185  q[j][k][l] *= -1.0;
186  if (i < 6) {
187  r[j][k][l] =
188  cpdata[patchdata[i][j * 4 + (3 - k)]][l];
189  if (l == 0)
190  r[j][k][l] *= -1.0;
191  s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
192  if (l == 0)
193  s[j][k][l] *= -1.0;
194  if (l == 1)
195  s[j][k][l] *= -1.0;
196  }
197  }
198  }
199  }
200  glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
201  &tex[0][0][0]);
202  glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
203  &p[0][0][0]);
204  glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
205  glEvalMesh2(type, 0, grid, 0, grid);
206  glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
207  &q[0][0][0]);
208  glEvalMesh2(type, 0, grid, 0, grid);
209  if (i < 6) {
210  glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
211  &r[0][0][0]);
212  glEvalMesh2(type, 0, grid, 0, grid);
213  glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
214  &s[0][0][0]);
215  glEvalMesh2(type, 0, grid, 0, grid);
216  }
217  }
218  glPopAttrib();
219 }
220 
221 
222 // Now the OSG wrapper for the above OpenGL code, the most complicated bit is computing
223 // the bounding box for the above example, normally you'll find this the easy bit.
224 class Teapot : public osg::Drawable
225 {
226  public:
227  Teapot() {}
228 
229  /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
230  Teapot(const Teapot& teapot,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
231  osg::Drawable(teapot,copyop) {}
232 
233  META_Object(myTeapotApp,Teapot)
234 
235 
236  // the draw immediate mode method is where the OSG wraps up the drawing of
237  // of OpenGL primitives.
238  virtual void drawImplementation(osg::RenderInfo&) const
239  {
240  // teapot(..) doesn't use vertex arrays at all so we don't need to toggle their state
241  // if we did we'd need to do something like the following call
242  // state.disableAllVertexArrays(), see src/osg/Geometry.cpp for the low down.
243 
244  // just call the OpenGL code.
245  teapot(14,GL_FILL);
246  }
247 
248 
249  // we need to set up the bounding box of the data too, so that the scene graph knows where this
250  // object is, for both positioning the camera at start up, and most importantly for culling.
251  virtual osg::BoundingBox computeBound() const
252  {
253  osg::BoundingBox bbox;
254 
255  // following is some truly horrible code required to calculate the
256  // bounding box of the teapot. Have used the original code above to do
257  // help compute it.
258  float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
259  long i, j, k, l;
260 
261  for (i = 0; i < 10; i++) {
262  for (j = 0; j < 4; j++) {
263  for (k = 0; k < 4; k++) {
264 
265  for (l = 0; l < 3; l++) {
266  p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
267  q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
268  if (l == 1)
269  q[j][k][l] *= -1.0;
270 
271  if (i < 6) {
272  r[j][k][l] =
273  cpdata[patchdata[i][j * 4 + (3 - k)]][l];
274  if (l == 0)
275  r[j][k][l] *= -1.0;
276  s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
277  if (l == 0)
278  s[j][k][l] *= -1.0;
279  if (l == 1)
280  s[j][k][l] *= -1.0;
281  }
282  }
283 
284  bbox.expandBy(osg::Vec3(p[j][k][0],p[j][k][1],p[j][k][2]));
285  bbox.expandBy(osg::Vec3(q[j][k][0],q[j][k][1],q[j][k][2]));
286 
287  if (i < 6)
288  {
289  bbox.expandBy(osg::Vec3(r[j][k][0],r[j][k][1],r[j][k][2]));
290  bbox.expandBy(osg::Vec3(s[j][k][0],s[j][k][1],s[j][k][2]));
291  }
292 
293 
294  }
295  }
296  }
297 
298  return bbox;
299  }
300 
301  protected:
302 
303  virtual ~Teapot() {}
304 
305 };
306 
307 
308 osg::Geode* createTeapot()
309 {
310  osg::Geode* geode = new osg::Geode();
311 
312  // add the teapot to the geode.
313  geode->addDrawable( new Teapot );
314 
315  // add a reflection map to the teapot.
316  osg::Image* image = osgDB::readImageFile("Images/reflect.rgb");
317  if (image)
318  {
319  osg::Texture2D* texture = new osg::Texture2D;
320  texture->setImage(image);
321 
322  osg::TexGen* texgen = new osg::TexGen;
323  texgen->setMode(osg::TexGen::SPHERE_MAP);
324 
325  osg::StateSet* stateset = new osg::StateSet;
326  stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
327  stateset->setTextureAttributeAndModes(0,texgen,osg::StateAttribute::ON);
328 
329  geode->setStateSet(stateset); osg::Quat newrot;
330 
331  }
332 
333  return geode;
334 }
335 
336 
337  void
338 dm_osgInit(struct dm *dmp)
339 {
340  struct osg_stuff *osp;
341  Window win;
342 
343  assert(dmp);
344  assert(!dmp->dm_osgData);
345 
346  win = ((struct dm_xvars *)(dmp->dm_vars.pub_vars))->win;
347 
348  //create our graphics context directly so we can pass our own window
349  osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
350 
351  // Init the Windata Variable that holds the handle for the Window to display OSG in.
352  osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowX11::WindowData(win);
353 
354  // Setup the traits parameters
355  traits->x = 0;
356  traits->y = 0;
357  traits->width = dmp->dm_width;
358  traits->height = dmp->dm_height;
359  traits->depth = 24;
360  //traits->alpha = 8;
361  //traits->stencil = 8;
362  traits->windowDecoration = false;
363  traits->doubleBuffer = true;
364  traits->sharedContext = 0;
365  traits->setInheritedWindowPixelFormat = true;
366  //traits->windowName = "osgViewer";
367 
368  traits->inheritedWindowData = windata;
369 
370  // Create the Graphics Context
371  osg::ref_ptr<osg::GraphicsContext> graphicsContext = osg::GraphicsContext::createGraphicsContext(traits.get());
372 
373  //osgViewer::Viewer *viewer = new osgViewer::Viewer();
374  //osp->viewer = viewer;
375  osp = (struct osg_stuff *)bu_calloc(sizeof(struct osg_stuff), 1, "osg_stuff");
376  osp->viewer = new osgViewer::Viewer();
377  //osp->viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
378 
379  if (graphicsContext) {
380  //osp->viewer->setUpViewerAsEmbeddedInWindow(0, 0, dmp->dm_width, dmp->dm_height);
381 
382  osp->viewer->getCamera()->setGraphicsContext(graphicsContext);
383  osp->viewer->getCamera()->setViewport(new osg::Viewport(0, 0, dmp->dm_width, dmp->dm_height));
384  //osp->viewer->getCamera()->setProjectionMatrixAsOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 2.0);
385  osp->viewer->getCamera()->setClearColor(osg::Vec4(1.0f, 1.0f, 1.0f, 0.0f));
386  //osp->viewer->getCamera()->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
387  }
388 
389  osp->viewer->setCameraManipulator( new osgGA::TrackballManipulator() );
390  osp->viewer->getCamera()->setAllowEventFocus(false);
391  osp->viewer->getCamera()->getProjectionMatrixAsFrustum(osp->left, osp->right, osp->bottom, osp->top, osp->near, osp->far);
392  osp->prev_pflag = dmp->dm_perspective;
393 
394  // Default values are as follows:
395  //
396  // left - -0.325000, right - 0.325000, bottom - -0.260000, top - 0.260000, near - 1.000000, far - 10000.000000
397  //
398 
399  //osp->viewer->setCameraManipulator( new osgGA::TrackballManipulator() );
400  //osp->viewer->setCameraManipulator( new osgGA::OrbitManipulator() );
401  //osp->viewer->setCameraManipulator( new osgGA::FirstPersonManipulator() );
402  //osp->viewer->setCameraManipulator( new osgGA::TerrainManipulator() );
403  //osp->viewer->setCameraManipulator( new osgGA::SphericalManipulator() );
404  //osp->viewer->setCameraManipulator( new osgGA::FlightManipulator() );
405 
406  bu_log("max frame rate - %lf\n", osp->viewer->getRunMaxFrameRate());
407 
408  dmp->dm_osgData = (void *)osp;
409  bu_log("dm_osgInit: leave\n");
410 }
411 
412 
413  void
414 dm_osgReshape(struct dm *dmp)
415 {
416  struct osg_stuff *osp;
417 
418  bu_log("dm_osgReshape: enter\n");
419  assert(dmp);
420 
421  if (!dmp->dm_osgData) {
422  bu_log("dm_osgReshape: leave early\n");
423  return;
424  }
425 
426  osp = (struct osg_stuff *)dmp->dm_osgData;
427  //osp->viewer->getCamera()->setViewport(new osg::Viewport(0, 0, dmp->dm_width, dmp->dm_height));
428 
429  osp->viewer->getEventQueue()->windowResize(0, 0, dmp->dm_width, dmp->dm_height);
430  osp->viewer->getCamera()->getGraphicsContext()->resized(0, 0, dmp->dm_width, dmp->dm_height);
431 
432  bu_log("dm_osgReshape: leave\n");
433 }
434 
435 
436  void
437 dm_osgPaint(struct dm *dmp)
438 {
439  struct osg_stuff *osp;
440 
441  assert(dmp);
442  assert(dmp->dm_osgData);
443 
444  if (dmp->dm_perspective == 0)
445  return;
446 
447  osp = (struct osg_stuff *)dmp->dm_osgData;
448  osp->viewer->frame();
449 }
450 
451 
452  void
453 dm_osgLoadMatrix(struct dm *dmp, matp_t mp)
454 {
455  struct osg_stuff *osp;
456 
457  assert(dmp);
458  assert(dmp->dm_osgData);
459 
460  if (dmp->dm_perspective == 0)
461  return;
462 
463  osp = (struct osg_stuff *)dmp->dm_osgData;
464  osgGA::TrackballManipulator *tbmp = (dynamic_cast<osgGA::TrackballManipulator *>(osp->viewer->getCameraManipulator()));
465  quat_t quat;
466  osg::Quat rot;
467  osg::Vec3d old_center;
468  osg::Vec3d center;
469  mat_t brl_rot;
470  mat_t brl_invrot;
471  mat_t brl_center;
472 
473  // Set the view rotation
474  quat_mat2quat(quat, mp);
475  rot.set(quat[X], quat[Y], quat[Z], quat[W]);
476  tbmp->setRotation(rot);
477 
478  // Set the view center by first extracting the
479  // view center from mp by backing out the rotation.
480  quat_quat2mat(brl_rot, quat);
481  bn_mat_inv(brl_invrot, brl_rot);
482  bn_mat_mul(brl_center, brl_invrot, mp);
483  center.set(-brl_center[MDX], -brl_center[MDY], -brl_center[MDZ]);
484  old_center = tbmp->getCenter();
485  tbmp->setCenter(center);
486 
487  // bu_log("dm_osgLoadMatrix: mp[MSA] - %lf\n", mp[MSA]);
488 
489  // Set the distance from eye to center
490  //XXX the current use of dm_perspective is only temporary. At the moment, if dm_perspective is non zero
491  // a perspective matrix from brlcad is passed in. We don't want this.
492  if (dmp->dm_perspective == 0) {
493  tbmp->setDistance(mp[MSA]);
494 
495  if (osp->prev_pflag != dmp->dm_perspective) {
496  bu_log("Setting projection as frustum\n");
497  osp->viewer->getCamera()->setProjectionMatrixAsFrustum(osp->left, osp->right, osp->bottom, osp->top, osp->near, osp->far);
498  }
499 
500  osp->prev_pflag = dmp->dm_perspective;
501  } else {
502  fastf_t sa;
503 
504  if (mp[MSA] < 0)
505  sa = -mp[MSA];
506  else
507  sa = mp[MSA];
508 
509  osp->viewer->getCamera()->setProjectionMatrixAsOrtho(-mp[MSA], mp[MSA], -mp[MSA], mp[MSA], 0.0, 2.0);
510  osp->prev_pflag = dmp->dm_perspective;
511  }
512 }
513 
514 
515 
516 /*
517  * Local Variables:
518  * tab-width: 8
519  * mode: C
520  * indent-tabs-mode: t
521  * c-file-style: "stroustrup"
522  * End:
523  * ex: shiftwidth=4 tabstop=8
524  */
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
int dm_width
Definition: dm_private.h:91
double top
Definition: osg.cpp:51
void * pub_vars
Definition: dm_private.h:35
virtual ~Teapot()
Definition: osg_bob.cpp:303
int prev_pflag
Definition: osg.cpp:52
if lu s
Definition: nmg_mod.c:3860
double far
Definition: osg.cpp:51
Header file for the BRL-CAD common definitions.
void dm_osgReshape(struct dm *dmp)
Definition: osg_bob.cpp:414
Definition: color.c:49
int dm_perspective
!0 means perspective on
Definition: dm_private.h:111
void * bu_calloc(size_t nelem, size_t elsize, const char *str)
Definition: malloc.c:321
double left
Definition: osg.cpp:51
#define __BEGIN_DECLS
Definition: common.h:73
void bn_mat_inv(mat_t output, const mat_t input)
Teapot(const Teapot &teapot, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition: osg_bob.cpp:230
void bn_mat_mul(mat_t o, const mat_t a, const mat_t b)
long Window
Definition: dm_xvars.h:50
double near
Definition: osg.cpp:51
osg::Geode * createTeapot()
Definition: osg_bob.cpp:308
void dm_osgPaint(struct dm *dmp)
Definition: osg_bob.cpp:437
Teapot()
Definition: osg_bob.cpp:227
double bottom
Definition: osg.cpp:51
struct dm_vars dm_vars
display manager dependent variables
Definition: dm_private.h:99
fastf_t grid[10][10][3]
Definition: nurb_example.c:40
int dm_height
Definition: dm_private.h:92
void dm_osgLoadMatrix(struct dm *dmp, matp_t mp)
Definition: osg_bob.cpp:453
osg::ref_ptr< osgViewer::Viewer > viewer
Definition: osg.cpp:50
double right
Definition: osg.cpp:51
void quat_quat2mat(mat_t mat, const quat_t quat)
Convert Quaternion to Matrix.
Definition: color.c:51
#define __END_DECLS
Definition: common.h:74
void quat_mat2quat(quat_t quat, const mat_t mat)
Quaternion math routines.
void dm_osgInit(struct dm *dmp)
Definition: osg_bob.cpp:338
double fastf_t
Definition: defines.h:300
Definition: color.c:50