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

MathUtils.ceilPowerOfTwo()

MathUtils.ceilPowerOfTwo() 是 Three.js 中的一个函数,用于在给定值上取上限的最小二的幂(2^n)。

用法

MathUtils.ceilPowerOfTwo(value)

参数

  • value - 将要进行计算的值。

返回值

函数将返回大于或等于给定值的最小二的幂(2^n)。

示例

console.log(MathUtils.ceilPowerOfTwo(12)); //16
console.log(MathUtils.ceilPowerOfTwo(35)); //64
console.log(MathUtils.ceilPowerOfTwo(128)); //128

限制

由于返回值限制为2的幂值,因此该函数的返回值通常适用于 Three.js 函数。

参考文献