@@ -22,6 +22,7 @@ import { Color } from '../math/Color.js';
2222import { Object3D } from '../core/Object3D.js' ;
2323import { Group } from '../objects/Group.js' ;
2424import { InstancedMesh } from '../objects/InstancedMesh.js' ;
25+ import { BatchedMesh } from '../../examples/jsm/objects/BatchedMesh.js' ;
2526import { Sprite } from '../objects/Sprite.js' ;
2627import { Points } from '../objects/Points.js' ;
2728import { Line } from '../objects/Line.js' ;
@@ -59,6 +60,8 @@ import { Loader } from './Loader.js';
5960import { FileLoader } from './FileLoader.js' ;
6061import * as Geometries from '../geometries/Geometries.js' ;
6162import { getTypedArray } from '../utils.js' ;
63+ import { Box3 } from '../math/Box3.js' ;
64+ import { Sphere } from '../math/Sphere.js' ;
6265
6366class ObjectLoader extends Loader {
6467
@@ -897,6 +900,52 @@ class ObjectLoader extends Loader {
897900
898901 break ;
899902
903+ case 'BatchedMesh' :
904+
905+ geometry = getGeometry ( data . geometry ) ;
906+ material = getMaterial ( data . material ) ;
907+
908+ object = new BatchedMesh ( data . maxGeometryCount , data . maxVertexCount , data . maxIndexCount , material ) ;
909+ object . geometry = geometry ;
910+ object . perObjectFrustumCulled = data . perObjectFrustumCulled ;
911+ object . sortObjects = data . sortObjects ;
912+
913+ object . _drawRanges = data . drawRanges ;
914+ object . _reservedRanges = data . reservedRanges ;
915+
916+ object . _visible = data . visible ;
917+ object . _active = data . active ;
918+ object . _bounds = data . bounds . map ( bound => {
919+
920+ const box = new Box3 ( ) ;
921+ box . min . fromArray ( bound . boxMin ) ;
922+ box . max . fromArray ( bound . boxMax ) ;
923+
924+ const sphere = new Sphere ( ) ;
925+ sphere . radius = bound . sphereRadius ;
926+ sphere . center . fromArray ( bound . sphereCenter ) ;
927+
928+ return {
929+ boxInitialized : bound . boxInitialized ,
930+ box : box ,
931+
932+ sphereInitialized : bound . sphereInitialized ,
933+ sphere : sphere
934+ } ;
935+
936+ } ) ;
937+
938+ object . _maxGeometryCount = data . maxGeometryCount ;
939+ object . _maxVertexCount = data . maxVertexCount ;
940+ object . _maxIndexCount = data . maxIndexCount ;
941+
942+ object . _geometryInitialized = data . geometryInitialized ;
943+ object . _geometryCount = data . geometryCount ;
944+
945+ object . _matricesTexture = getTexture ( data . matricesTexture . uuid ) ;
946+
947+ break ;
948+
900949 case 'LOD' :
901950
902951 object = new LOD ( ) ;
0 commit comments