Exemplo n.º 1
0
void Camera::recalculateProjection() const
{
    m_projection->setToIdentity();
    m_projection->perspective(fovy(), static_cast<float>(viewport().width()) / viewport().height(), zNear(), zFar());
    *m_projectionInverted = m_projection->inverted();
    m_isProjectionInvalid = false;
}
Lens :: Lens(
	double fovy_,
	double nearClip,
	double farClip,
	double focalLength,
	double eyeSep
)
:	mNear(nearClip),
	mFar(farClip),
	mFocalLength(focalLength),
	mEyeSep(eyeSep)
{
	fovy(fovy_);
}
Lens& Lens::fovx(double v, double aspect) {
	fovy(Lens::getFovyForFovX(v, aspect));
	return *this;
}
Lens& Lens::fovy(double v){
	static const double cDeg2Rad = M_PI / 180.;
	mFovy = v;
	mTanFOV = tan(fovy() * cDeg2Rad*0.5);
	return *this;
}