Changeset 7

Show
Ignore:
Timestamp:
10/04/07 16:38:15
Author:
robert
Message:

Added support for reading from configuration file without automatic view
configuration.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Makefile

    r1 r7  
    11# CMAKE generated file: DO NOT EDIT! 
    2 # Generated by "Unix Makefiles" Generator, CMake Version 2.5 
     2# Generated by "Unix Makefiles" Generator, CMake Version 2.4 
    33 
    44# Default target executed when no arguments are given to make. 
     
    2626 
    2727# The CMake executable. 
    28 CMAKE_COMMAND = /usr/local/bin/cmake 
     28CMAKE_COMMAND = /usr/bin/cmake 
    2929 
    3030# The command to remove a file. 
    31 RM = /usr/local/bin/cmake -E remove -f 
     31RM = /usr/bin/cmake -E remove -f 
    3232 
    3333# The program to use to edit the cache. 
    34 CMAKE_EDIT_COMMAND = /usr/local/bin/ccmake 
     34CMAKE_EDIT_COMMAND = /usr/bin/ccmake 
    3535 
    3636# The top-level source directory on which CMake was run. 
     
    4949edit_cache: 
    5050        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 
    51         /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 
     51        /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 
    5252 
    5353# Special rule for the target edit_cache 
     
    5757install: preinstall 
    5858        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." 
    59         /usr/local/bin/cmake -P cmake_install.cmake 
     59        /usr/bin/cmake -P cmake_install.cmake 
    6060 
    6161# Special rule for the target install 
    6262install/fast: preinstall/fast 
    6363        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." 
    64         /usr/local/bin/cmake -P cmake_install.cmake 
     64        /usr/bin/cmake -P cmake_install.cmake 
    6565 
    6666# Special rule for the target install/local 
    6767install/local: preinstall 
    6868        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." 
    69         /usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake 
     69        /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake 
    7070 
    7171# Special rule for the target install/local 
    7272install/local/fast: install/local 
    73  
    74 # Special rule for the target install/strip 
    75 install/strip: preinstall 
    76         @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." 
    77         /usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake 
    78  
    79 # Special rule for the target install/strip 
    80 install/strip/fast: install/strip 
    8173 
    8274# Special rule for the target list_install_components 
     
    9082rebuild_cache: 
    9183        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 
    92         /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 
     84        /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 
    9385 
    9486# Special rule for the target rebuild_cache 
     
    151143        @echo "... install" 
    152144        @echo "... install/local" 
    153         @echo "... install/strip" 
    154145        @echo "... list_install_components" 
    155146        @echo "... rebuild_cache" 
  • trunk/src/present3D.cpp

    r6 r7  
    5656void setViewer(osgViewer::Viewer& viewer, float width, float height, float distance) 
    5757{ 
    58     unsigned int numCameras = viewer.getNumSlaves(); 
    59     if (numCameras==2) 
    60     { 
    61         // hardwire dual screen horizontal split screen up. 
    62      
    63         osg::DisplaySettings* ds = osg::DisplaySettings::instance(); 
    64         if (ds->getStereoMode()==osg::DisplaySettings::HORIZONTAL_SPLIT && ds->getStereo()) 
    65         { 
    66             osg::Matrix identity; 
    67          
    68             osg::ref_ptr<osg::DisplaySettings> ds_left = new osg::DisplaySettings(*ds); 
    69             ds_left->setStereoMode(osg::DisplaySettings::LEFT_EYE); 
    70              
    71             osg::ref_ptr<osg::DisplaySettings> ds_right = new osg::DisplaySettings(*ds); 
    72             ds_right->setStereoMode(osg::DisplaySettings::RIGHT_EYE); 
    73              
    74             unsigned int leftCameraNum = (ds->getSplitStereoHorizontalEyeMapping()==osg::DisplaySettings::LEFT_EYE_LEFT_VIEWPORT) ? 0 : 1; 
    75             unsigned int rightCameraNum = (ds->getSplitStereoHorizontalEyeMapping()==osg::DisplaySettings::LEFT_EYE_LEFT_VIEWPORT) ? 1 : 0; 
    76  
    77             viewer.getSlave(leftCameraNum)._projectionOffset.makeIdentity(); 
    78             viewer.getSlave(leftCameraNum)._viewOffset.makeIdentity(); 
    79             // left to do. 
    80             //osgUtil::SceneView* sv_left = viewer.getSceneHandlerList()[leftCameraNum]->getSceneView(); 
    81             //sv_left->setDisplaySettings(ds_left); 
    82                  
    83             viewer.getSlave(rightCameraNum)._projectionOffset.makeIdentity(); 
    84             viewer.getSlave(rightCameraNum)._viewOffset.makeIdentity(); 
    85             // left to do. 
    86             //osgUtil::SceneView* sv_right = viewer.getSceneHandlerList()[rightCameraNum]->getSceneView(); 
    87             //sv_right->setDisplaySettings(ds_right);                 
    88         } 
    89     } 
    90  
    9158    double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0); 
    9259    double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0); 
     
    9562    viewer.getCamera()->setCullMask(0xffffffff); 
    9663    viewer.getCamera()->setCullMaskLeft(0x00000001); 
    97     viewer.getCamera()->setCullMaskRight(0x00000002); 
    98      
     64    viewer.getCamera()->setCullMaskRight(0x00000002);    
    9965} 
    10066 
     
    231197#endif     
    232198     
     199    bool doSetViewer = true; 
     200    std::string configurationFile; 
     201 
     202    // check env vars for configuration file 
     203    const char* str = getenv("PRESENT3D_CONFIG_FILE"); 
     204    if (!str) str = getenv("OSG_CONFIG_FILE"); 
     205    if (str) configurationFile = str; 
     206 
     207    // check command line parameters for configuration file. 
     208    while (arguments.read("-c",configurationFile)) {} 
     209 
    233210    // construct the viewer. 
    234211    osgViewer::Viewer viewer(arguments); 
     212     
     213    if (!configurationFile.empty()) 
     214    { 
     215        viewer.readConfiguration(configurationFile); 
     216        doSetViewer = false; 
     217    } 
     218     
    235219 
    236220    // set up the camera manipulators. 
     
    274258 
    275259 
    276     bool doSetViewer = true; 
    277260    while (arguments.read("--set-viewer")) { doSetViewer = true; } 
    278261     
     
    375358    ApplicationType applicationType = VIEWER; 
    376359 
    377     char* str = getenv("PRESENT3D_TYPE"); 
     360    str = getenv("PRESENT3D_TYPE"); 
    378361    if (str) 
    379362    {