コード例 #1
0
void Sketch::setup() 
{
    #ifdef CEFIX_FOR_IPHONE
        getMainWindow()->setTrackballManipulator(new osgGA::MultiTouchTrackballManipulator());
        getMainWindow()->setCameraManipulator(getMainWindow()->getTrackballManipulator());
    #endif
    
    float ss1_m = 7;        // some convenient defaults for demo
	float ss1_a = 1;
	float ss1_b = 1;
	float ss1_n1 = 0.2;
	float ss1_n2 = 1.7;
	float ss1_n3 = 1.7;
	float ss2_m = 7;
	float ss2_a = 1;
	float ss2_b = 1;
	float ss2_n1 = 0.2;
	float ss2_n2 = 1.7;
	float ss2_n3 = 1.7;
	
	_drawable = new SuperShape3D(ss1_m, ss1_a, ss1_b, ss1_n1, ss1_n2, ss1_n3, ss2_m, ss2_a, ss2_b, ss2_n1, ss2_n2, ss2_n3, 60);
	osg::Geode* geode = new osg::Geode();
	geode->addDrawable(_drawable);
	_mat = new osg::MatrixTransform();
	_mat->addChild(geode);
	getWorld()->addChild(_mat);
	
	// allow osg-event handler:
	allowOsgHandler(true);
    
	
}
コード例 #2
0
ファイル: Sketch.cpp プロジェクト: cefix/examples
void Sketch::setup() 
{
	// set window size
	size(1024, 768);
	
	// create a box + drawable
	osg::Box* box = new osg::Box();
	_drawable = new osg::ShapeDrawable(box);
	osg::Geode* geode = new osg::Geode();
	geode->addDrawable(_drawable.get());
	getWorld()->addChild(geode);
	
	// allow osg-event handler:
	allowOsgHandler(true);
    
    getMainWindow()->addDevice(new SpaceNavigatorDevice());
    getMainWindow()->setCameraManipulator(new SpaceNavigatorCameraManipulator());
	
	_down = 0;
}