本文整理汇总了TypeScript中neuroglancer/util/geom.mat4.perspective方法的典型用法代码示例。如果您正苦于以下问题:TypeScript mat4.perspective方法的具体用法?TypeScript mat4.perspective怎么用?TypeScript mat4.perspective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuroglancer/util/geom.mat4
的用法示例。
在下文中一共展示了mat4.perspective方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('works for simple example', () => {
const m = mat4.perspective(mat4.create(), Math.PI / 2, 4.0, 7, 113);
const planes = getFrustrumPlanes(new Float32Array(24), m);
expect(isAABBVisible(-1, -1, -20, 1, 1, -15, planes)).toBe(true);
expect(isAABBVisible(-50, -1, -8, -40, 1, -7, planes)).toBe(false);
expect(isAABBVisible(40, -1, -8, 50, 1, -7, planes)).toBe(false);
expect(isAABBVisible(-1, -50, -8, 1, -40, -7, planes)).toBe(false);
expect(isAABBVisible(-1, 40, -8, 1, 50, -7, planes)).toBe(false);
expect(isAABBVisible(-1, -1, -112, 1, 1, -113, planes)).toBe(true);
expect(isAABBVisible(-1, -1, -114, 1, 1, -118, planes)).toBe(false);
});
示例2: it
it('getMultiscaleChunksToDraw simple', () => {
const manifest: MultiscaleMeshManifest = {
chunkShape: vec3.fromValues(10, 20, 30),
chunkGridSpatialOrigin: vec3.fromValues(5, 6, -50),
clipLowerBound: vec3.fromValues(20, 23, -50),
clipUpperBound: vec3.fromValues(40, 45, -20),
lodScales: [20, 40],
chunkCoordinates: Uint32Array.from([
0, 0, 0, //
]),
};
const viewportWidth = 640;
const viewportHeight = 480;
const modelViewProjection =
mat4.perspective(mat4.create(), Math.PI / 2, viewportWidth / viewportHeight, 5, 100);
expect(getChunkList(
manifest, modelViewProjection, /*detailCutoff=*/ 1000, viewportWidth, viewportHeight))
.toEqual([{
lod: 1,
renderScale: 960,
beginIndex: 0,
endIndex: 1,
}]);
expect(getChunkList(
manifest, modelViewProjection, /*detailCutoff=*/ 800, viewportWidth, viewportHeight))
.toEqual([
{
lod: 1,
renderScale: 960,
beginIndex: 0,
endIndex: 1,
},
{
lod: 0,
renderScale: 480,
beginIndex: 0,
endIndex: 1,
}
]);
});