Example #1
0
File: main.cpp Project: Risca/sgct
void myPreSyncFun()
{
	if( gEngine->isMaster() )
	{
		curr_time.setVal( sgct::Engine::getTime() );
		
		//if texture is uploaded then iterate the index
		if (serverUploadDone.getVal() && clientsUploadDone.getVal())
		{
			texIndex++;
			serverUploadDone = false;
			clientsUploadDone = false;
		}
	}
}
Example #2
0
void myPostSyncPreDrawFun()
{
	if (takeScreenshot.getVal())
	{
		gEngine->takeScreenshot();
		takeScreenshot.setVal(false);
	}
}
Example #3
0
void myDecodeFun()
{
	sgct::SharedData::instance()->readDouble(&curr_time);
    sgct::SharedData::instance()->readFloat(&sharedSpeed);
    speed = sharedSpeed.getVal();
    sgct::SharedData::instance()->readBool(&sharedTextureOnOff);
    use_texture = sharedTextureOnOff.getVal();
    sgct::SharedData::instance()->readObj(&sharedClearColor);
    clear_color.x = sharedClearColor.getVal().x;
    clear_color.y = sharedClearColor.getVal().y;
    clear_color.z = sharedClearColor.getVal().z;
}
Example #4
0
File: main.cpp Project: Risca/sgct
void threadWorker(void *arg)
{
    while (running.getVal())
	{
		//runs only on master
		if (transfer.getVal() && !serverUploadDone.getVal() && !clientsUploadDone.getVal())
        {
			startDataTransfer();
            transfer.setVal(false);
            
            //load texture on master
            uploadTexture();
			serverUploadDone = true;
            
            if(sgct_core::ClusterManager::instance()->getNumberOfNodes() == 1) //no cluster
            {
				clientsUploadDone = true;
            }
        }

		sgct::Engine::sleep(0.1); //ten iteration per second
	}
}
Example #5
0
File: main.cpp Project: Risca/sgct
void myPostSyncPreDrawFun()
{
	gEngine->setWireframe(wireframe.getVal());
	gEngine->setDisplayInfoVisibility(info.getVal());
	gEngine->setStatsGraphVisibility(stats.getVal());

	if( takeScreenshot.getVal() )
	{
		gEngine->takeScreenshot();
		takeScreenshot.setVal(false);
	}

	light.getVal() ? mRootNode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE) :
		mRootNode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);

	mSceneTrans->setMatrix(osg::Matrix::rotate( glm::radians(curr_time.getVal() * 8.0), 0.0, 1.0, 0.0));
	mSceneTrans->postMult(osg::Matrix::translate(0.0, -0.1, dist.getVal()));

	//transform to scene transformation from configuration file
	mSceneTrans->postMult( osg::Matrix( glm::value_ptr( gEngine->getModelMatrix() ) ));

	//update the frame stamp in the viewer to sync all
	//time based events in osg
	mFrameStamp->setFrameNumber( gEngine->getCurrentFrameNumber() );
	mFrameStamp->setReferenceTime( curr_time.getVal() );
	mFrameStamp->setSimulationTime( curr_time.getVal() );
	mViewer->setFrameStamp( mFrameStamp.get() );
	mViewer->advance( curr_time.getVal() ); //update

	//traverse if there are any tasks to do
	if (!mViewer->done())
	{
		mViewer->eventTraversal();
		//update travelsal needed for pagelod object like terrain data etc.
		mViewer->updateTraversal();
	}
}
Example #6
0
File: main.cpp Project: Risca/sgct
void myPostSyncPreDrawFun()
{
    if( reloadShader.getVal() )
    {
        reloadShader.setVal(false); //reset

        sgct::ShaderProgram sp = sgct::ShaderManager::instance()->getShaderProgram( "xform" );
        sp.reload();

        //reset location variables
        sgct::ShaderManager::instance()->bindShaderProgram( "xform" );
        time_loc = sgct::ShaderManager::instance()->getShaderProgram( "xform").getUniformLocation( "curr_time" );
        matrix_loc = sgct::ShaderManager::instance()->getShaderProgram( "xform").getUniformLocation( "MVP" );
        sgct::ShaderManager::instance()->unBindShaderProgram();
    }
}
Example #7
0
File: main.cpp Project: Risca/sgct
void myPostSyncPreDrawFun()
{
	gEngine->setWireframe(wireframe.getVal());
	gEngine->setDisplayInfoVisibility(info.getVal());
	gEngine->setStatsGraphVisibility(stats.getVal());
	sgct_core::ClusterManager::instance()->getTrackingManagerPtr()->setEnabled(useTracking.getVal());

	if( takeScreenshot.getVal() )
	{
		gEngine->takeScreenshot();
		takeScreenshot.setVal(false);
	}

	if( reloadShaders.getVal() )
	{
		fx.getShaderProgram()->reload();
		reloadShaders.setVal(false);
		sgct::ShaderManager::instance()->reloadShaderProgram("Heightmap");
	}
}
Example #8
0
File: main.cpp Project: Risca/sgct
void myPostSyncPreDrawFun()
{
	gEngine->setDisplayInfoVisibility(info.getVal());
	gEngine->setStatsGraphVisibility(stats.getVal());
}