Exemplo n.º 1
0
    public Camera(Vec3 origin, Vec3 lookAt, Vec3 up, int width, int height, float verticalFov)
    {
        this.width       = new SpecializedValue <int>(width);
        this.height      = new SpecializedValue <int>(height);
        this.verticalFov = verticalFov;
        this.origin      = origin;
        this.lookAt      = lookAt;
        this.up          = up;

        axis = OrthoNormalBasis.fromZY(Vec3.unitVector(lookAt - origin), up);

        aspectRatio      = ((float)width / (float)height);
        cameraPlaneDist  = 1.0f / XMath.Tan(verticalFov * XMath.PI / 360.0f);
        reciprocalHeight = 1.0f / height;
        reciprocalWidth  = 1.0f / width;
    }