Exemplo n.º 1
0
unsigned int Camera::Initialize()
{
    m_viewMatrix = glm::mat4();
    m_projMatrix = glm::mat4();
    m_viewProjMatrix = glm::mat4();

    m_position = glm::vec3(0.0f, 0.0f, 10.0f);
    m_target = glm::vec3();
    m_up = glm::vec3(0.0f, 1.0f, 0.0f);

    m_direction = glm::vec3();
    m_right = glm::vec3();

    m_windowWidth = CSSET_WINDOW_WIDTH_DEFAULT;
    m_windowHeight = CSSET_WINDOW_HEIGHT_DEFAULT;

    // now try to read real values
    Engine* engine = System::GetInstance()->GetEngineData();
    m_windowWidth = (float)engine->width;
    m_windowHeight = (float)engine->height;

    CalculateProjection();
    CalculateViewProjection();

    return CS_ERR_NONE;
}
Exemplo n.º 2
0
void Camera::FlushDimensions()
{
    Engine* engine = System::GetInstance()->GetEngineData();
    m_windowWidth = (float)engine->width;
    m_windowHeight = (float)engine->height;
    CalculateProjection();
    CalculateViewProjection();
}
Exemplo n.º 3
0
unsigned int Camera::Update()
{
    if (m_projDirty)
    {
        CalculateProjection();
        m_projDirty = false;
    }
    if (m_viewDirty)
    {
        CalculateViewProjection();
        m_viewDirty = false;
    }

    return CS_ERR_NONE;
}
Exemplo n.º 4
0
Camera::Camera(XMFLOAT4 eye, XMFLOAT4 at, XMFLOAT4 up, FLOAT windowWidth, FLOAT windowHeight, FLOAT nearDepth, FLOAT farDepth)
	: _eye(eye), _at(at), _up(up), _windowWidth(windowWidth), _windowHeight(windowHeight), _nearDepth(nearDepth), _farDepth(farDepth)
{
	CalculateViewProjection();
}