Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
61b03565
Commit
61b03565
authored
Mar 09, 2018
by
Pavel Rojtberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ovis: allow manipulating entity material and scale at runtime
parent
7d1aca38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
ovis.hpp
modules/ovis/include/opencv2/ovis.hpp
+17
-0
ovis.cpp
modules/ovis/src/ovis.cpp
+27
-0
No files found.
modules/ovis/include/opencv2/ovis.hpp
View file @
61b03565
...
...
@@ -38,6 +38,12 @@ enum MaterialProperty
MATERIAL_TEXTURE
};
enum
EntityProperty
{
ENTITY_MATERIAL
,
ENTITY_SCALE
,
};
/**
* A 3D viewport and the associated scene
*/
...
...
@@ -76,6 +82,17 @@ public:
*/
CV_WRAP
virtual
void
removeEntity
(
const
String
&
name
)
=
0
;
/**
* set the property of an entity to the given value
* @param name entity name
* @param prop @ref EntityProperty
* @param value the value
*/
CV_WRAP
virtual
void
setEntityProperty
(
const
String
&
name
,
int
prop
,
const
Scalar
&
value
)
=
0
;
/// @overload
CV_WRAP
virtual
void
setEntityProperty
(
const
String
&
name
,
int
prop
,
const
String
&
value
)
=
0
;
/**
* convenience method to visualize a camera position
*
...
...
modules/ovis/src/ovis.cpp
View file @
61b03565
...
...
@@ -427,6 +427,33 @@ public:
node
.
setPosition
(
t
);
}
void
setEntityProperty
(
const
String
&
name
,
int
prop
,
const
String
&
value
)
{
CV_Assert
(
prop
==
ENTITY_MATERIAL
);
SceneNode
&
node
=
_getSceneNode
(
sceneMgr
,
name
);
MaterialPtr
mat
=
MaterialManager
::
getSingleton
().
getByName
(
value
,
RESOURCEGROUP_NAME
);
CV_Assert
(
mat
&&
"material not found"
);
Camera
*
cam
=
dynamic_cast
<
Camera
*>
(
node
.
getAttachedObject
(
name
));
if
(
cam
)
{
cam
->
setMaterial
(
mat
);
return
;
}
Entity
*
ent
=
dynamic_cast
<
Entity
*>
(
node
.
getAttachedObject
(
name
));
CV_Assert
(
ent
&&
"invalid entity"
);
ent
->
setMaterial
(
mat
);
}
void
setEntityProperty
(
const
String
&
name
,
int
prop
,
const
Scalar
&
value
)
{
CV_Assert
(
prop
==
ENTITY_SCALE
);
SceneNode
&
node
=
_getSceneNode
(
sceneMgr
,
name
);
node
.
setScale
(
value
[
0
],
value
[
1
],
value
[
2
]);
}
void
_createBackground
()
{
String
name
=
"_"
+
sceneMgr
->
getName
()
+
"_DefaultBackground"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment