本文整理汇总了TypeScript中THREE.Matrix4.getInverse方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Matrix4.getInverse方法的具体用法?TypeScript Matrix4.getInverse怎么用?TypeScript Matrix4.getInverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THREE.Matrix4
的用法示例。
在下文中一共展示了Matrix4.getInverse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: pan
pan (x: number, y: number) {
this._setPanVector(x, y)
tmpPanMatrix.getInverse(this.viewer.rotationGroup.matrix)
tmpPanVector.applyMatrix4(tmpPanMatrix)
this.controls.translate(tmpPanVector)
}
示例2: _transformPanVector
private _transformPanVector () {
if (!this.component) return
tmpPanMatrix.extractRotation(this.component.transform)
tmpPanMatrix.premultiply(this.viewer.rotationGroup.matrix)
tmpPanMatrix.getInverse(tmpPanMatrix)
tmpPanVector.applyMatrix4(tmpPanMatrix)
}
示例3: setMatrix
/**
* set transformation matrix
* @param {Matrix4} matrix - 4x4 transformation matrix
* @return {undefined}
*/
setMatrix (matrix: Matrix4) {
this.matrix.copy(matrix)
const bb = this.boundingBox
const v = this.center // temporary re-purposing
const x = this.nx - 1
const y = this.ny - 1
const z = this.nz - 1
bb.makeEmpty()
bb.expandByPoint(v.set(x, y, z))
bb.expandByPoint(v.set(x, y, 0))
bb.expandByPoint(v.set(x, 0, z))
bb.expandByPoint(v.set(x, 0, 0))
bb.expandByPoint(v.set(0, y, z))
bb.expandByPoint(v.set(0, 0, z))
bb.expandByPoint(v.set(0, y, 0))
bb.expandByPoint(v.set(0, 0, 0))
bb.applyMatrix4(this.matrix)
bb.getCenter(this.center)
// make normal matrix
const me = this.matrix.elements
const r0 = new Vector3(me[0], me[1], me[2])
const r1 = new Vector3(me[4], me[5], me[6])
const r2 = new Vector3(me[8], me[9], me[10])
const cp = new Vector3()
// [ r0 ] [ r1 x r2 ]
// M3x3 = [ r1 ] N = [ r2 x r0 ]
// [ r2 ] [ r0 x r1 ]
const ne = this.normalMatrix.elements
cp.crossVectors(r1, r2)
ne[ 0 ] = cp.x
ne[ 1 ] = cp.y
ne[ 2 ] = cp.z
cp.crossVectors(r2, r0)
ne[ 3 ] = cp.x
ne[ 4 ] = cp.y
ne[ 5 ] = cp.z
cp.crossVectors(r0, r1)
ne[ 6 ] = cp.x
ne[ 7 ] = cp.y
ne[ 8 ] = cp.z
this.inverseMatrix.getInverse(this.matrix)
}
示例4: updateMaterialUniforms
export function updateMaterialUniforms (group: Object3D, camera: Camera, renderer: WebGLRenderer, cDist: number, bRadius: number) {
const {width, height} = renderer.getSize()
const canvasHeight = height
const pixelRatio = renderer.getPixelRatio()
const ortho = camera.type === 'OrthographicCamera'
resolution.set(width, height)
projectionMatrixInverse.getInverse(camera.projectionMatrix)
projectionMatrixTranspose.copy(camera.projectionMatrix).transpose()
group.traverse(function (o: any) {
const m = o.material
if (!m) return
const u = m.uniforms
if (!u) return
if (m.clipNear) {
const nearFactor = (50 - m.clipNear) / 50
const nearClip = cDist - (bRadius * nearFactor)
u.clipNear.value = nearClip
}
if (u.canvasHeight) {
u.canvasHeight.value = canvasHeight
}
if (u.resolution) {
u.resolution.value.copy(resolution)
}
if (u.pixelRatio) {
u.pixelRatio.value = pixelRatio
}
if (u.projectionMatrixInverse) {
u.projectionMatrixInverse.value.copy(projectionMatrixInverse)
}
if (u.projectionMatrixTranspose) {
u.projectionMatrixTranspose.value.copy(projectionMatrixTranspose)
}
if (u.ortho) {
u.ortho.value = ortho
}
})
}
示例5: rotateComponent
rotateComponent (x: number, y: number) {
if (!this.component) return
const [ dx, dy ] = this._getRotateXY(x, y)
tmpRotateMatrix.extractRotation(this.component.transform)
tmpRotateMatrix.premultiply(this.viewer.rotationGroup.matrix)
tmpRotateMatrix.getInverse(tmpRotateMatrix)
tmpRotateVector.set(1, 0, 0)
tmpRotateVector.applyMatrix4(tmpRotateMatrix)
tmpRotateXMatrix.makeRotationAxis(tmpRotateVector, dy)
tmpRotateVector.set(0, 1, 0)
tmpRotateVector.applyMatrix4(tmpRotateMatrix)
tmpRotateYMatrix.makeRotationAxis(tmpRotateVector, dx)
tmpRotateXMatrix.multiply(tmpRotateYMatrix)
tmpRotateQuaternion.setFromRotationMatrix(tmpRotateXMatrix)
this.component.quaternion.premultiply(tmpRotateQuaternion)
this.component.updateMatrix()
}
示例6: updateCameraUniforms
export function updateCameraUniforms (group: Object3D, camera: Camera) {
projectionMatrixInverse.getInverse(camera.projectionMatrix)
projectionMatrixTranspose.copy(camera.projectionMatrix).transpose()
group.traverse(function (o: any) {
const m = o.material
if (!m) return
const u = m.uniforms
if (!u) return
if (u.projectionMatrixInverse) {
u.projectionMatrixInverse.value.copy(projectionMatrixInverse)
}
if (u.projectionMatrixTranspose) {
u.projectionMatrixTranspose.value.copy(projectionMatrixTranspose)
}
})
}