const StereoEyeParams& StereoConfig::GetEyeRenderParams(StereoEye eye)
{
    static const UByte eyeParamIndices[3] = { 0, 0, 1 };

    updateIfDirty();
    OVR_ASSERT(eye < sizeof(eyeParamIndices));
    return EyeRenderParams[eyeParamIndices[eye]];
}
Example #2
0
unsigned int CustomVisualizer::visualizerTextureId() const
{ 
	updateIfDirty();
	return m_visualizerDocument ? m_visualizerDocument->getFBO().texture() : 0; 
}
Example #3
0
void PandaDocument::step()
{
	m_stepQueued = false;
	if (m_stepCanceled)	// The user clicked stop after a step has been queued
	{
		m_stepCanceled = false;
		return;
	}

	auto startTime = std::chrono::high_resolution_clock::now();
	panda::helper::UpdateLogger::getInstance()->startLog(this);

	setInStep(true);
	// Force the value of isInStep, because some objects will propagate dirtyValue during beginStep
	for(auto& object : m_objectsList->get())
		object->setInStep(true);

	updateDocumentData();

	setDirtyValue(this);
	updateIfDirty();

	setInStep(false);
	for(auto& object : m_objectsList->get())
		object->endStep();

	panda::helper::UpdateLogger::getInstance()->stopLog();

	m_signals->timeChanged.run();

	for (auto obj : m_dirtyObjects)
		m_signals->dirtyObject.run(obj);
	m_dirtyObjects.clear();

	m_signals->modified.run();

	if (m_animPlaying)	
	{
		m_stepQueued = true; // We want another step
		if (m_useTimer.getValue()) // Restart the timer taking into consideration the time it took to render this frame
		{
			auto endTime = std::chrono::high_resolution_clock::now();
			auto frameDuration = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
			double delay = m_timestep.getValue() - frameDuration.count() / 1000.0 - 0.001; // How long do we wait until we start the next step ?
			TimedFunctions::cancelRun(m_animFunctionIndex); // Remove previous
			m_animFunctionIndex = TimedFunctions::delayRun(delay, [this]() { // Ask for the delayed execution of step()
				m_gui.executeByUI([this]() { step(); });  // But we want step() to be run on the GUI thread
			});
		}
		else
			m_gui.executeByUI([this]() { step(); }); // Run ASAP on the GUI thread
	}

	++m_iNbFrames;
	auto now = currentTime();
	float elapsedDur = static_cast<float>(toSeconds(now - m_fpsTime));
	if(m_animPlaying && elapsedDur > 1.0)
	{
		m_currentFPS = m_iNbFrames / elapsedDur;
		m_fpsTime = now;
		m_iNbFrames = 0;
	}
}
Example #4
0
	void endStep()
	{
		PandaObject::endStep();
		updateIfDirty();
	}