Ejemplo n.º 1
0
void Camera::RotUp(float deltaTime)
{
	if(m_rot.x + deltaTime*rotspeed < X_LIMIT)
		m_rot.x += deltaTime*rotspeed;
	else
		m_rot.x = X_LIMIT;
	calculateViewMatrix();
}
Ejemplo n.º 2
0
void Camera::RotDown(float deltaTime)
{
	if(m_rot.x - deltaTime*rotspeed > -X_LIMIT)
		m_rot.x += -deltaTime*rotspeed;
	else
		m_rot.x = -X_LIMIT;
	calculateViewMatrix();
}
Ejemplo n.º 3
0
void Camera::moveUp(float deltaTime)
{

	Vector4 movelocal = Vector4(0.f, deltaTime*movespeed, 0.f, 1.f);
	calculateWorldMatrix();
	Vector4 moveworld = movelocal * m_world;
	m_pos = Vector3(moveworld.x, moveworld.y, moveworld.z);
	calculateViewMatrix();
}
Ejemplo n.º 4
0
void Camera::startSync()
{
    if (viewUpdated_)
    {
        temporaryViewMatrix_ = calculateViewMatrix();
        syncView_ = true;
        viewUpdated_ = false;
    }

    if (projectionUpdated_)
    {
        temporaryProjMatrix_ = getProjectionMatrix();
        syncProjection_ = true;
        projectionUpdated_ = false;
    }
}
Ejemplo n.º 5
0
Camera::Camera(glm::vec3 sceneDimensions):
    _angX(0),
    _angY(0),
    _locked(true),
	_interpolate(false),
	_attached(nullptr),
	_radius(2.0f)
{
    _model = glm::scale(glm::mat4(), glm::vec3(2 / sceneDimensions[0], 2 / sceneDimensions[1], 2 / sceneDimensions[2]));
    _vup = glm::vec3(0, 1, 0);
    _dir = glm::vec3(-1, -1, 0); // _vrp = (0, 0, 0) = (1, 1, 0) + (-1, -1, 0)
    _obs = glm::vec3(1, 1, 0);

    _aspect = 4.0f/ 3.0f;

    calculateViewMatrix();
    calculateProjectionMatrix();
}
Ejemplo n.º 6
0
void Camera::RotRight(float deltaTime)
{
	m_rot.y += -deltaTime*rotspeed;
	calculateViewMatrix();
}
Ejemplo n.º 7
0
glm::mat4 Camera::getViewMatrix(){
    return calculateViewMatrix();
}