@@ -42,6 +42,7 @@ export class LLMesh
4242 mesh : number [ ] ,
4343 mesh_triangles : number
4444 }
45+ public submodel_id ?: number ;
4546
4647 public static async from ( buf : Buffer ) : Promise < LLMesh >
4748 {
@@ -77,6 +78,15 @@ export class LLMesh
7778 }
7879 break ;
7980 }
81+ case 'submodel_id' :
82+ {
83+ const int = obj [ key ] ;
84+ if ( int instanceof LLSDInteger )
85+ {
86+ llmesh . submodel_id = int . valueOf ( ) ;
87+ }
88+ break ;
89+ }
8090 case 'date' :
8191 {
8292 const dt = obj [ key ] ;
@@ -300,6 +310,10 @@ export class LLMesh
300310 {
301311 llsd . add ( 'version' , new LLSDInteger ( this . version ) ) ;
302312 }
313+ if ( this . submodel_id !== undefined )
314+ {
315+ llsd . add ( 'submodel_id' , new LLSDInteger ( this . submodel_id ) ) ;
316+ }
303317 if ( this . date !== undefined )
304318 {
305319 llsd . add ( 'date' , this . date ) ;
@@ -473,7 +487,7 @@ export class LLMesh
473487 private static parsePhysicsConvex ( mesh : LLSDMap ) : LLPhysicsConvex
474488 {
475489 const conv : LLPhysicsConvex = {
476- boundingVerts : [ ] ,
490+ boundingVerts : undefined ,
477491 domain : {
478492 min : new Vector3 ( [ - 0.5 , - 0.5 , - 0.5 ] ) ,
479493 max : new Vector3 ( [ 0.5 , 0.5 , 0.5 ] )
@@ -509,11 +523,10 @@ export class LLMesh
509523 throw new Error ( 'Hull list expected number of points does not match number of positions: ' + totalPoints + ' vs ' + conv . positions . length ) ;
510524 }
511525 }
512- if ( ! ( mesh . BoundingVerts instanceof Buffer ) )
526+ if ( mesh . BoundingVerts instanceof Buffer )
513527 {
514- throw new Error ( ' BoundingVerts is required' ) ;
528+ conv . boundingVerts = this . decodeByteDomain3 ( mesh . BoundingVerts , conv . domain . min , conv . domain . max ) ;
515529 }
516- conv . boundingVerts = this . decodeByteDomain3 ( mesh . BoundingVerts , conv . domain . min , conv . domain . max ) ;
517530 return conv ;
518531 }
519532
@@ -898,18 +911,21 @@ export class LLMesh
898911 llsd . add ( 'Positions' , buf ) ;
899912 }
900913 {
901- const buf = Buffer . allocUnsafe ( conv . boundingVerts . length * 6 ) ;
902- let pos = 0 ;
903- for ( const vec of conv . boundingVerts )
914+ if ( conv . boundingVerts )
904915 {
905- buf . writeUInt16LE ( Math . round ( ( ( vec . x - conv . domain . min . x ) / sizeX ) * 65535 ) , pos ) ;
906- pos = pos + 2 ;
907- buf . writeUInt16LE ( Math . round ( ( ( vec . y - conv . domain . min . y ) / sizeY ) * 65535 ) , pos ) ;
908- pos = pos + 2 ;
909- buf . writeUInt16LE ( Math . round ( ( ( vec . z - conv . domain . min . z ) / sizeZ ) * 65535 ) , pos ) ;
910- pos = pos + 2 ;
916+ const buf = Buffer . allocUnsafe ( conv . boundingVerts . length * 6 ) ;
917+ let pos = 0 ;
918+ for ( const vec of conv . boundingVerts )
919+ {
920+ buf . writeUInt16LE ( Math . round ( ( ( vec . x - conv . domain . min . x ) / sizeX ) * 65535 ) , pos ) ;
921+ pos = pos + 2 ;
922+ buf . writeUInt16LE ( Math . round ( ( ( vec . y - conv . domain . min . y ) / sizeY ) * 65535 ) , pos ) ;
923+ pos = pos + 2 ;
924+ buf . writeUInt16LE ( Math . round ( ( ( vec . z - conv . domain . min . z ) / sizeZ ) * 65535 ) , pos ) ;
925+ pos = pos + 2 ;
926+ }
927+ llsd . add ( 'BoundingVerts' , buf ) ;
911928 }
912- llsd . add ( 'BoundingVerts' , buf ) ;
913929 }
914930 return Utils . deflate ( LLSD . toBinary ( llsd ) ) ;
915931 }
0 commit comments