Fix WebGL build (#2189)

This commit is contained in:
Romain Guy
2020-02-29 09:14:49 -08:00
committed by GitHub
parent bb2571233d
commit b98f45df60
3 changed files with 11 additions and 1 deletions

View File

@@ -260,6 +260,7 @@ export class Camera {
public setProjectionFov(fovInDegrees: number, aspect: number,
near: number, far: number, fov: Camera$Fov): void;
public setLensProjection(focalLength: number, near: number, far: number): void;
public setLensProjectionWithAspect(focalLength: number, aspect: number, near: number, far: number): void;
public setCustomProjection(projection: mat4, near: number, far: number): void;
public getProjectionMatrix(): mat4;
public getCullingProjectionMatrix(): mat4;

View File

@@ -522,7 +522,15 @@ class_<Camera>("Camera")
self->setProjection(fovInDegrees, aspect, near, far, direction);
}), allow_raw_pointers())
.function("setLensProjection", &Camera::setLensProjection)
.function("setLensProjectionWithAspect", EMBIND_LAMBDA(void, (Camera* self,
double focalLength, double aspect, double near, double far), {
self->setLensProjection(focalLength, aspect, near, far);
}), allow_raw_pointers())
.function("setLensProjection", EMBIND_LAMBDA(void, (Camera* self,
double focalLength, double near, double far), {
self->setLensProjection(focalLength, near, far);
}), allow_raw_pointers())
.function("setCustomProjection", EMBIND_LAMBDA(void, (Camera* self,
flatmat4 m, double near, double far), {

View File

@@ -44,6 +44,7 @@ function smoke_camera_frustum() {
camera.setProjection(Filament.Camera$Projection.ORTHO, 0, 1, 0, 1, 0, 1);
camera.setProjectionFov(45, 1.0, 0.0, 1.0, Filament.Camera$Fov.HORIZONTAL);
camera.setLensProjection(0, 1, 2);
camera.setLensProjectionWithAspect(0, 0.33, 1, 2);
camera.setCustomProjection(m4, 0, 1);
const m5 = camera.getProjectionMatrix() as glm.mat4;
const m6 = camera.getCullingProjectionMatrix() as glm.mat4;