Example #1
0
bool CameraManager::setUp() {
    bindCamera(0);
    setCaptureSize(_defaultSize);
	//_extractor.setScoreMatZeroAndSize(_defaultSize);
	if(_capture.isOpened()) {
        return true;
    }
	return false;
}
Example #2
0
void SpaceShip::stepMainThread (float dtime)
{
	// Used for camera binding:
	m_relpos_old = rotateVecByQuat(game->getPlayer()->getPos() - m_pos, conjugateQuat(m_quat));
	m_quat_old = m_quat;

	m_gravity_acc = game->getWorldEnv()->getGravityAcc(m_pos);
	m_acceleration  = m_engine_acc + m_gravity_acc;

	physicalMove(dtime);
	m_time += dtime;
	m_time_since_acc += dtime;

	// SpaceShip uses a dtime that is 10 times faster
	// so that speeds of 10 rotations per second
	// can be achieved. Otherwise, quaternions-rotations would cancel out and therefore
	// go backward again
	float dtime_fast = dtime * 10.0;
	m_velquat	= glm::slerp(m_velquat, m_velquat * m_accquat, dtime_fast);
	m_quat		= glm::slerp(m_quat, m_quat  * m_velquat, dtime_fast);

	m_quat		= glm::normalize(m_quat);
	m_velquat	= glm::normalize(m_velquat);
	m_accquat	= glm::normalize(m_accquat);

	bindCamera(dtime);

	/*
		Move FireParticleSource
	*/
	float particleIntensity = 1.0 - (m_time_since_acc / PARTICLE_FLOWDURATION);
	if (particleIntensity < 0) particleIntensity = 0;
	m_psource->setIntensity(PARTICLE_MAXINTENSITY * particleIntensity);
	m_psource->setPos(m_pos - quatToVector(m_quat) * 50.0 * USC);
	m_psource->setDir(quatToVector(m_quat) * -1);
	m_psource->setInitialVelocity(m_velocity);
}