@Override public SoundSource<T> setPosition(Vector3f value) { if (value == null || this.position.equals(value)) { return this; } this.position.set(value); alSource3f(getSourceId(), AL10.AL_POSITION, value.x, value.y, value.z); OpenALException.checkState("Changing sound position"); return this; }
@Override public SoundSource<T> setVelocity(Vector3f value) { if (value == null || this.velocity.equals(value)) { return this; } this.velocity.set(value); AL10.alSource3f(getSourceId(), AL10.AL_VELOCITY, value.x, value.y, value.z); OpenALException.checkState("Setting sound source velocity"); return this; }
@Override public SoundSource<T> setDirection(Vector3f value) { if (value == null || this.direction.equals(value)) { return this; } AL10.alSource3f(getSourceId(), AL10.AL_DIRECTION, value.x, value.y, value.z); OpenALException.checkState("Setting sound source direction"); this.direction.set(value); return this; }
@Override public void updateMatrices(float fov) { prevViewProjectionMatrix.set(viewProjectionMatrix); // Nothing to do... if (cachedPosition.equals(getPosition()) && cachedViewigDirection.equals(getViewingDirection()) && cachedZFar == zFar && cachedZNear == zNear) { return; } projectionMatrix = MatrixUtils.createOrthogonalProjectionMatrix(left, right, top, bottom, zNear, zFar); viewMatrix = MatrixUtils.createViewMatrix(0f, 0.0f, 0f, viewingDirection.x, viewingDirection.y, viewingDirection.z, up.x, up.y, up.z); normViewMatrix = MatrixUtils.createViewMatrix(0f, 0f, 0f, viewingDirection.x, viewingDirection.y, viewingDirection.z, up.x, up.y, up.z); viewProjectionMatrix = MatrixUtils.calcViewProjectionMatrix(viewMatrix, projectionMatrix); inverseViewProjectionMatrix.invert(viewProjectionMatrix); // Used for dirty checks cachedPosition.set(getPosition()); cachedViewigDirection.set(getViewingDirection()); cachedZFar = zFar; cachedZNear = zNear; updateFrustum(); }
@Override public void updateMatrices(float fov) { if (cachedPosition.equals(getPosition()) && cachedViewigDirection.equals(getViewingDirection()) && cachedBobbingRotationOffsetFactor == bobbingRotationOffsetFactor && cachedBobbingVerticalOffsetFactor == bobbingVerticalOffsetFactor && cachedFov == fov