本文整理匯總了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,
}
]);
});