Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ofxaddons
ofxCloudLib
Commits
fa9b1ba6
Commit
fa9b1ba6
authored
Sep 17, 2017
by
alexandre burton
Browse files
Ajout d'une classe Calibration pour afficher des boîtes via config JSON
parent
abe9296c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ofxCloudLib/Calibration.hpp
0 → 100644
View file @
fa9b1ba6
#ifndef Calibration_h
#define Calibration_h
#include
"ofMain.h"
class
Marqueur
{
public:
Marqueur
(
size_t
id
,
glm
::
vec3
position
,
glm
::
vec3
dimension
)
{
position_
=
position
;
dimension_
=
dimension
;
id_
=
id
;
}
void
draw
()
{
ofPushStyle
();
ofPushMatrix
();
ofDrawBox
(
position_
,
dimension_
.
x
,
dimension_
.
y
,
dimension_
.
z
);
ofTranslate
(
position_
);
ofDrawBitmapString
(
"M"
+
ofToString
(
id_
),
0
,
0
);
ofPopMatrix
();
ofPopStyle
();
}
glm
::
vec3
position_
;
glm
::
vec3
dimension_
;
size_t
id_
;
};
class
Calibration
{
public:
Calibration
()
{};
void
setup
(
std
::
string
json_path
)
{
ofFile
file
(
json_path
);
if
(
file
.
exists
()){
file
>>
js_
;
for
(
auto
&
marqueur
:
js_
[
"marqueurs"
]){
marqueurs_
.
push_back
(
make_unique
<
Marqueur
>
(
marqueur
[
"id"
],
glm
::
vec3
(
marqueur
[
"position"
][
0
],
marqueur
[
"position"
][
1
],
marqueur
[
"position"
][
2
]),
glm
::
vec3
(
marqueur
[
"dimension"
][
0
],
marqueur
[
"dimension"
][
1
],
marqueur
[
"dimension"
][
2
])));
}
return
true
;
}
else
{
std
::
cout
<<
"Calibration: configuration non-existante: "
<<
json_path
<<
std
::
endl
;
return
false
;
}
}
void
draw
()
{
for
(
const
auto
&
marqueur
:
marqueurs_
)
{
marqueur
->
draw
();
}
}
std
::
vector
<
std
::
unique_ptr
<
Marqueur
>>
marqueurs_
;
ofJson
js_
;
};
#endif
/* Calibration_h */
Write
Preview
Supports
Markdown
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