Hi All ,
I am trying to place some characters (cal3D) on a terrain I created
using VPB at a particular location on the terrain using the code shown
below. But when i run my program i do not see any thing,  using mouse
(trackball) functionality i cam locate the terrain but could not locate
the model. Can some one tell me what am i doing wrong. I am using latest
version of osgCal2 (checked out from svn ) and OSG 2.0.

int main(int argc, char** argv)
{
    if (argc < 2)
    {
        std::cout << "specify cal3D cfg file for loading a model " <<
std::endl;
        return 1;
    }

    // Create and setup core model
    osg::ref_ptr< osgCal::CoreModel > coreModel( new osgCal::CoreModel() );
   
    osg::ref_ptr< osgCal::BasicMeshAdder > meshAdder( new
osgCal::DefaultMeshAdder );
    osg::ref_ptr< osgCal::MeshParameters > p( new osgCal::MeshParameters );
    p->software = true;

    // Load core model from file
    coreModel->load(argv[1]);


    // Create Model
    osgCal::Model* model = new osgCal::Model();

    // Load model
    model->load(coreModel.get(), meshAdder.get());   

    // Create a root node for the scene graph
    osg::Group* root = new osg::Group;

    // Load terrain from the file
    osg::Node* terrainNode = osgDB::readNodeFile("oahu.osga");

    // Add terrain to the scene
    root->addChild(terrainNode);


    // Choose a location on a terrain to place the model
    osg::Vec3  newPos(2356473.250, 611159.125, 1.515);

    // Create a position attitude transform node
    osg::PositionAttitudeTransform* pat =  new
osg::PositionAttitudeTransform;
    // Set position
    pat->setPosition(newPos);


    // Add character model to the pat
    pat->addChild(model);


    // Add pat to the scene
    root->addChild(pat);


    // Setup viewer
    osgViewer::Viewer viewer;

    // Set scene data
    viewer.setSceneData(root);
   
    viewer.run();

    return 0;
}

cheers
RJ
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to