File tree 2 files changed +38
-0
lines changed 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ enum EntityProperty
45
45
{
46
46
ENTITY_MATERIAL,
47
47
ENTITY_SCALE,
48
+ ENTITY_AABB_WORLD
48
49
};
49
50
50
51
/* *
@@ -106,6 +107,14 @@ class CV_EXPORTS_W WindowScene {
106
107
// / @overload
107
108
CV_WRAP virtual void setEntityProperty (const String& name, int prop, const String& value) = 0;
108
109
110
+ /* *
111
+ * get the property of an entity
112
+ * @param name entity name
113
+ * @param prop @ref EntityProperty
114
+ * @param value the value
115
+ */
116
+ CV_WRAP virtual void getEntityProperty (const String& name, int prop, OutputArray value) = 0;
117
+
109
118
/* *
110
119
* convenience method to visualize a camera position
111
120
*
Original file line number Diff line number Diff line change @@ -563,6 +563,35 @@ class WindowSceneImpl : public WindowScene
563
563
node.setScale (value[0 ], value[1 ], value[2 ]);
564
564
}
565
565
566
+ void getEntityProperty (const String& name, int prop, OutputArray value)
567
+ {
568
+ SceneNode& node = _getSceneNode (sceneMgr, name);
569
+ switch (prop)
570
+ {
571
+ case ENTITY_SCALE:
572
+ {
573
+ Vector3 s = node.getScale ();
574
+ Mat_<Real>(1 , 3 , s.ptr ()).copyTo (value);
575
+ return ;
576
+ }
577
+ case ENTITY_AABB_WORLD:
578
+ {
579
+ Entity* ent = dynamic_cast <Entity*>(node.getAttachedObject (name));
580
+ CV_Assert (ent && " invalid entity" );
581
+ AxisAlignedBox aabb = ent->getWorldBoundingBox (true );
582
+ Vector3 mn = aabb.getMinimum ();
583
+ Vector3 mx = aabb.getMaximum ();
584
+ Mat_<Real> ret (2 , 3 );
585
+ Mat_<Real>(1 , 3 , mn.ptr ()).copyTo (ret.row (0 ));
586
+ Mat_<Real>(1 , 3 , mx.ptr ()).copyTo (ret.row (1 ));
587
+ ret.copyTo (value);
588
+ return ;
589
+ }
590
+ default :
591
+ CV_Error (Error::StsBadArg, " unsupported property" );
592
+ }
593
+ }
594
+
566
595
void _createBackground ()
567
596
{
568
597
String name = " _" + sceneMgr->getName () + " _DefaultBackground" ;
You can’t perform that action at this time.
0 commit comments