本文整理匯總了TypeScript中neuroglancer/util/geom.mat4類的典型用法代碼示例。如果您正苦於以下問題:TypeScript mat4類的具體用法?TypeScript mat4怎麽用?TypeScript mat4使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了mat4類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
return this.scales.map(scaleInfo => {
return VolumeChunkSpecification
.getDefaults({
voxelSize: scaleInfo.resolution,
dataType: this.dataType,
numChannels: this.numChannels,
transform: mat4.fromTranslation(
mat4.create(),
vec3.multiply(vec3.create(), scaleInfo.resolution, scaleInfo.voxelOffset)),
upperVoxelBound: scaleInfo.size,
volumeType: this.volumeType,
chunkDataSizes: scaleInfo.chunkSizes,
baseVoxelOffset: scaleInfo.voxelOffset,
compressedSegmentationBlockSize: scaleInfo.compressedSegmentationBlockSize,
volumeSourceOptions,
})
.map(spec => this.chunkManager.getChunkSource(PrecomputedVolumeChunkSource, {
spec,
parameters: {
'baseUrls': this.baseUrls,
'path': `${this.path}/${scaleInfo.key}`,
'encoding': scaleInfo.encoding
}
}));
});
示例2: getStaticAnnotations
getStaticAnnotations() {
const baseScale = this.scales[0];
const annotationSet =
new AnnotationSource(mat4.fromScaling(mat4.create(), baseScale.resolution));
annotationSet.readonly = true;
annotationSet.add(makeDataBoundsBoundingBox(
baseScale.voxelOffset, vec3.add(vec3.create(), baseScale.voxelOffset, baseScale.size)));
return annotationSet;
}
示例3: 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);
});
示例4:
return this.scales.map(levelScales => levelScales.map(scaleInfo => {
const spec = VolumeChunkSpecification.withDefaultCompression({
voxelSize: scaleInfo.voxelSize,
dataType,
volumeType,
numChannels,
transform: mat4.fromTranslation(mat4.create(), scaleInfo.offset),
upperVoxelBound: scaleInfo.sizeInVoxels,
upperClipBound: upperClipBound,
chunkDataSize: scaleInfo.chunkDataSize!, volumeSourceOptions,
});
return VolumeChunkSource.get(
this.chunkManager, spec,
{baseUrls: this.baseUrls, key: scaleInfo.key, encoding: encoding});
}));
示例5: 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,
}
]);
});
示例6: getSources
getSources(volumeSourceOptions: VolumeSourceOptions) {
let {info} = this;
const spec = VolumeChunkSpecification.withDefaultCompression({
volumeType: info.volumeType,
chunkDataSize: info.volumeSize,
dataType: info.dataType,
voxelSize: info.voxelSize,
numChannels: info.numChannels,
upperVoxelBound: info.volumeSize,
transform: translationRotationScaleZReflectionToMat4(
mat4.create(), info.qoffset, info.quatern, kOneVec, info.qfac),
volumeSourceOptions,
});
return [[VolumeChunkSource.get(this.chunkManager, spec, {url: this.url})]];
}
示例7: convertAffine
function convertAffine(affine: number[][]) {
return mat4.fromValues(
affine[0][0], affine[1][0], affine[2][0], affine[3][0], affine[0][1], affine[1][1],
affine[2][1], affine[3][1], affine[0][2], affine[1][2], affine[2][2], affine[3][2],
affine[0][3], affine[1][3], affine[2][3], affine[3][3]);
}