@@ -476,6 +476,56 @@ func TestModel_BoundingBox(t *testing.T) {
476
476
}}},
477
477
}},
478
478
}, Box {Min : Point3D {10 , 20 , 30 }, Max : Point3D {110 , 120 , 130 }}},
479
+ {"non-root-model" , & Model {
480
+ Build : Build {Items : []* Item {
481
+ {ObjectID : 2 , Transform : Identity (), AnyAttr : spec.AnyAttr {& fakeAttr {Value : "/other.model" }}},
482
+ }},
483
+ Resources : Resources {},
484
+ Childs : map [string ]* ChildModel {
485
+ "/other.model" : & ChildModel {
486
+ Resources : Resources {Objects : []* Object {
487
+ {ID : 1 , Mesh : & Mesh {Vertices : Vertices {Vertex : []Point3D {
488
+ {0 , 10 , 20 },
489
+ {100 , 110 , 120 },
490
+ }}}},
491
+ {ID : 2 , Components : & Components {Component : []* Component {
492
+ {ObjectID : 1 , Transform : Identity ().Translate (10 , 10 , 10 )},
493
+ {ObjectID : 10 },
494
+ }}},
495
+ }},
496
+ },
497
+ },
498
+ }, Box {Min : Point3D {10 , 20 , 30 }, Max : Point3D {110 , 120 , 130 }}},
499
+ {"model-tree" , & Model {
500
+ Build : Build {Items : []* Item {
501
+ {ObjectID : 2 , Transform : Identity (), AnyAttr : spec.AnyAttr {& fakeAttr {Value : "/other.model" }}},
502
+ }},
503
+ Resources : Resources {},
504
+ Childs : map [string ]* ChildModel {
505
+ "/leaf.model" : & ChildModel {
506
+ Resources : Resources {Objects : []* Object {
507
+ {ID : 1 , Mesh : & Mesh {Vertices : Vertices {Vertex : []Point3D {
508
+ {0 , 10 , 20 },
509
+ {100 , 110 , 120 },
510
+ }}}},
511
+ }},
512
+ },
513
+ "/another.model" : & ChildModel {
514
+ Resources : Resources {Objects : []* Object {
515
+ {ID : 2 , Components : & Components {Component : []* Component {
516
+ {ObjectID : 1 , Transform : Identity ().Translate (7 , 7 , 7 ), AnyAttr : spec.AnyAttr {& fakeAttr {Value : "/leaf.model" }}},
517
+ }}},
518
+ }},
519
+ },
520
+ "/other.model" : & ChildModel {
521
+ Resources : Resources {Objects : []* Object {
522
+ {ID : 2 , Components : & Components {Component : []* Component {
523
+ {ObjectID : 2 , Transform : Identity ().Translate (3 , 3 , 3 ), AnyAttr : spec.AnyAttr {& fakeAttr {Value : "/another.model" }}},
524
+ }}},
525
+ }},
526
+ },
527
+ },
528
+ }, Box {Min : Point3D {10 , 20 , 30 }, Max : Point3D {110 , 120 , 130 }}},
479
529
}
480
530
for _ , tt := range tests {
481
531
t .Run (tt .name , func (t * testing.T ) {
0 commit comments