InventorUtilities.C File Reference

Code that is shared between simpleview and render. More...

#include <cstdio>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/SoOffscreenRenderer.h>
#include <Inventor/SoOutput.h>
#include <Inventor/sensors/SoTimerSensor.h>
#include <Inventor/actions/SoWriteAction.h>
#include <Inventor/events/SoMouseButtonEvent.h>
#include <Inventor/events/SoLocation2Event.h>
#include <Inventor/events/SoKeyboardEvent.h>
#include <Inventor/nodes/SoEventCallback.h>
#include <Inventor/nodes/SoNode.h>
#include <Inventor/nodes/SoCamera.h>
#include <Inventor/nodes/SoPerspectiveCamera.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoSwitch.h>
#include <Inventor/nodes/SoPointLight.h>
#include <Inventor/nodes/SoLineSet.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/draggers/SoSpotLightDragger.h>
#include <VolumeViz/nodes/SoVolumeRendering.h>
#include "debug.H"

Functions

SbVec3f ToSbVec3f (const vector< float > &v)
vector< float > ToVector (const SbVec3f &SbV)
SbVec3f InterpolateVec (const SbVec3f &v1, SbVec3f &v2, const float percent)
SbRotation InterpolateRotations (const SbRotation &rot1, const SbRotation &rot2, const float percent)
vector< float > InterpolatePos (const vector< float > &v1, const vector< float > &v2, const float percent)
void SetCameraFromDragger (SoCamera *c, SoSpotLightDragger *d)
 Given a draggers set the camera view from it.
bool RenderFrameToDisk (const string &basename, const string &filetype, const int width, const int height, SoNode *root, size_t &frame_num, const SbColor &background)
 Ship off a picture to disk.
void ListWriteFileTypes ()
 Handle the --list command line option. Spits out the list of filetypes that work for rendering to files.
bool CheckTypeValid (const string &type)
 Check with coin/simage to see if the image extension works.
bool LoadSpotLightDraggers (const string filename, SoSeparator *root, vector< SoSpotLightDragger * > &draggerVec)
 Load dragger/way points from a disk file.
bool SaveSpotLightDraggersAscii (const string &filename, vector< SoSpotLightDragger * > &draggerVec)
 Save an ascii file of all the draggers for editing and reloading.
bool WriteSceneGraph (const string &filename, SoNode *root)
 Write a scene graph to disk as ascii.
bool CheckLibraryPath ()
 Help avoid problems with library paths. Especially on Darwin/OSX.

Variables

static const UNUSED char * RCSid = "$Id: InventorUtilities.C,v 1.3 2006/03/02 22:04:48 schwehr Exp $"
 Let the debugger find out which version is being used.


Detailed Description

Code that is shared between simpleview and render.


Function Documentation

bool CheckLibraryPath  ) 
 

Help avoid problems with library paths. Especially on Darwin/OSX.

Returns:
true if have the proper path. False if found something bad or lacking

bool CheckTypeValid const string &  type  ) 
 

Check with coin/simage to see if the image extension works.

Parameters:
type String of the file extension. For example rgb, png, jpg
Returns:
false if something went really bad with the lookup.

vector<float> InterpolatePos const vector< float > &  v1,
const vector< float > &  v2,
const float  percent
 

SbRotation InterpolateRotations const SbRotation &  rot1,
const SbRotation &  rot2,
const float  percent
 

SbVec3f InterpolateVec const SbVec3f &  v1,
SbVec3f &  v2,
const float  percent
 

void ListWriteFileTypes  ) 
 

Handle the --list command line option. Spits out the list of filetypes that work for rendering to files.

bool LoadSpotLightDraggers const string  filename,
SoSeparator *  root,
vector< SoSpotLightDragger * > &  draggerVec
 

Load dragger/way points from a disk file.

Parameters:
filename Ascii file to load from
root Where in the scene graph location to add the draggers (should be draggerSwitch
draggerVec A vector in which to keep the way points handy
Returns:
false if trouble loading the draggers/waypoints

bool RenderFrameToDisk const string &  basename,
const string &  filetype,
const int  width,
const int  height,
SoNode *  root,
size_t &  frame_num,
const SbColor &  background
 

Ship off a picture to disk.

Parameters:
basename start the file name with this
filetype the extension for the image format: jpg, png, etc...
width,height The size of the rendered frame
root Top of the scene graph to render
frame_num return the frame number that we wrote
Returns:
false if we flailed trying to get a pretty picture to disk
Bug:
FIX: could optimize by keeping one renderer in memory

bool SaveSpotLightDraggersAscii const string &  filename,
vector< SoSpotLightDragger * > &  draggerVec
 

Save an ascii file of all the draggers for editing and reloading.

Parameters:
filename file to write to
draggerVec pointers to all the SoSpotLightDragger way points
Returns:
false if had trouble writing the file

void SetCameraFromDragger SoCamera *  c,
SoSpotLightDragger *  d
 

Given a draggers set the camera view from it.

This is the simpler case where we do not have to interpolate between to draggers

SbVec3f ToSbVec3f const vector< float > &  v  ) 
 

vector<float> ToVector const SbVec3f &  SbV  ) 
 

bool WriteSceneGraph const string &  filename,
SoNode *  root
 

Write a scene graph to disk as ascii.

Parameters:
filename File to write ascii IV file to
root Starting point of the scene graph to same
Returns:
false if we were not able to open the file.


Variable Documentation

const UNUSED char* RCSid = "$Id: InventorUtilities.C,v 1.3 2006/03/02 22:04:48 schwehr Exp $" [static]
 

Let the debugger find out which version is being used.


Generated on Thu Mar 2 17:55:25 2006 for density by  doxygen 1.4.6