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

ObjectLoader.parseObject()

简介

ObjectLoader.parseObject()three.js中一个基于JSON格式的对象加载器。它会根据传入的参数,解析JSON数据,生成一个Object3D对象或相关的子类对象,用于在渲染器中进行3D渲染。

该方法是私有方法,一般不建议直接调用。

语法

parseObject( data, geometries, materials )

参数

  • dataJSON格式的数据,
  • geometries:几何体对象的库,用于保存已创建的几何体对象,可重用减少创建次数。
  • materials:材质对象的库,用于保存已创建的材质对象,可重用减少创建次数。

返回值

Object3D对象或相关的子类对象。

示例

import { ObjectLoader } from 'three';

const objectLoader = new ObjectLoader();

const data = {
  // JSON数据
};

const geometries = {
  // 几何体对象库
};

const materials = {
  // 材质对象库
};

const obj = objectLoader.parseObject( data, geometries, materials );

参考文献