BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Quaternion.fromBufferAttribute()

Quaternion.fromBufferAttribute(attribute: BufferAttribute, index: number, offset: number | undefined): Quaternion

该方法将从给定的缓冲区属性中检索四元数,并将其存储在给定的四元数对象中。该操作使用给定索引和偏移量来确定四元数的位置。

参数

  • attribute: BufferAttribute - 包含四元数的缓冲区属性。
  • index: number - 描述四元数的起始位置。
  • offset: number | undefined - 可选的缓冲区偏移量。

返回值

返回存储四元数的 Quaternion 对象。

示例

const quaternion = new THREE.Quaternion();
const bufferAttribute = new THREE.BufferAttribute(
  new Float32Array([0.7071067811865475, 0, 0, 0.7071067811865475]),
  4
);

THREE.Quaternion.fromBufferAttribute(bufferAttribute, 0, undefined, quaternion);

console.log(quaternion); // 输出 Quaternion { _x: 0.7071067811865475, _y: 0, _z: 0, _w: 0.7071067811865475 }

异常

  • 如果索引超出范围,则会抛出 RangeError

注意事项

  • fromBufferAttribute() 方法的工作方式类似于 fromArray() 方法,但具有更高的性能。
  • 如果 offset 参数未定义,则该方法将从给定索引处提取四元数。

参考文献