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
50f3b070
Commit
50f3b070
authored
Sep 17, 2017
by
alexandre burton
Browse files
CloudLib: differents tweaks pour la connexion Artnet et TCP
parent
1f5ef235
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/ofxCloudLib/ClientConnector.cpp
View file @
50f3b070
...
...
@@ -152,7 +152,7 @@ void ClientConnector::update()
string
str
=
receive
();
if
(
str
.
length
()
>
0
)
{
std
::
cout
<<
"PROCESSING TCP STREAM FROM "
<<
client_name_
<<
":"
<<
str
<<
std
::
endl
;
//
std::cout << "PROCESSING TCP STREAM FROM " << client_name_ << ":" << str << std::endl;
boost
::
char_separator
<
char
>
sep
(
" "
);
boost
::
tokenizer
<
boost
::
char_separator
<
char
>>
tokens
(
str
,
sep
);
...
...
@@ -161,7 +161,7 @@ void ClientConnector::update()
for
(
const
auto
&
t
:
tokens
)
{
message
.
push_back
(
t
);
std
::
cout
<<
" tokens:"
<<
t
<<
std
::
endl
;
//
std::cout << " tokens:" << t << std::endl;
}
if
(
message
.
size
()
==
0
)
{
std
::
cout
<<
"TCP erreur: message vide"
<<
std
::
endl
;
...
...
@@ -220,7 +220,7 @@ void ClientConnector::update()
std
::
cout
<<
"got TCP unknown msg from "
<<
client_name_
<<
":"
<<
str
<<
std
::
endl
;
}
std
::
cout
<<
"DONE PROCESSING TCP STREAM FROM "
<<
client_name_
<<
std
::
endl
;
//
std::cout << "DONE PROCESSING TCP STREAM FROM " << client_name_ << std::endl;
}
}
else
{
delta_time_
=
ofGetElapsedTimeMillis
()
-
connect_time_
;
...
...
src/ofxCloudLib/CropFilter.hpp
View file @
50f3b070
...
...
@@ -65,6 +65,8 @@ class CropFilter
{
index_
=
i
;
result_
.
reset
(
new
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
);
color_
.
setHsb
((
i
/
16.0
)
*
255
,
255
,
128
,
100
);
}
void
setup
()
...
...
@@ -82,16 +84,21 @@ class CropFilter
glm
::
vec3
fillsize
=
parameters_
.
dim_
.
get
()
*
glm
::
vec3
(
1
,
get_fill
(),
1
);
glm
::
vec3
fillpos
=
parameters_
.
pos_
.
get
()
-
glm
::
vec3
(
0
,
(
size
.
y
*
(
1.0
-
get_fill
()))
/
2
,
0
);
ofPushStyle
();
ofEnableBlendMode
(
OF_BLENDMODE_ADD
);
ofDisableDepthTest
();
if
(
parameters_
.
enabled_
)
{
ofSetColor
(
0
,
255
,
0
,
128
);
ofSetColor
(
color_
);
ofNoFill
();
ofDrawBox
(
parameters_
.
pos_
,
size
.
x
,
size
.
y
,
size
.
z
);
ofFill
();
auto
c
=
color_
;
c
.
a
=
ofMap
(
get_fill
(),
0
,
.25
,
10
,
50
,
true
);
if
(
parameters_
.
count_
>
0
)
{
glm
::
vec3
fillsize
=
parameters_
.
dim_
.
get
()
*
glm
::
vec3
(
1
,
get_fill
(),
1
);
glm
::
vec3
fillpos
=
parameters_
.
pos_
.
get
()
-
glm
::
vec3
(
0
,
(
size
.
y
*
(
1.0
-
get_fill
()))
/
2
,
0
);
ofSetColor
(
0
,
255
,
0
,
ofMap
(
get_fill
(),
0
,
.25
,
10
,
50
,
true
)
);
ofSetColor
(
c
);
ofDrawBox
(
fillpos
,
fillsize
.
x
,
fillsize
.
y
,
fillsize
.
z
);
}
if
(
parameters_
.
rms_
>
0
)
{
...
...
@@ -170,6 +177,7 @@ class CropFilter
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
result_
;
CropFilterParameterGroup
parameters_
;
glm
::
vec3
min_
,
max_
;
ofColor
color_
;
size_t
index_
;
// char * rgbw_[4];
...
...
@@ -206,7 +214,9 @@ class FilterManager
{
sender_
=
sender
;
rgbw_
.
allocate
(
num_filters
*
4
,
1
,
OF_IMAGE_COLOR_ALPHA
);
artnet_
.
setup
(
"192.168.94.62"
);
my_artnet_ip_
=
"192.168.94.62"
;
setup_artnet
();
parameters_
.
setName
(
"FilterManager"
);
parameters_
.
add
(
enabled_
.
set
(
"enabled"
,
true
));
...
...
@@ -217,6 +227,17 @@ class FilterManager
}
}
void
setup_artnet
()
{
std
::
cout
<<
"setting up artnet on "
<<
my_artnet_ip_
<<
std
::
endl
;
if
(
artnet_
!=
nullptr
)
{
std
::
cout
<<
"...(stopping previous instance)..."
<<
my_artnet_ip_
<<
std
::
endl
;
artnet_
->
waitForThread
();
artnet_
.
release
();
}
artnet_
=
make_unique
<
ofxArtnet
>
();
artnet_
->
setup
(
my_artnet_ip_
.
c_str
(),
0
,
0
);
}
void
update
(
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
input_cloud
)
{
ofxOscMessage
m
,
m_height
;
...
...
@@ -254,7 +275,9 @@ class FilterManager
rgbw_
.
getPixels
().
getData
()[
filter
->
index_
*
4
+
3
]
=
int
(
ofMap
(
amp
,
0
,
1
,
0
,
255
,
true
));
}
}
artnet_
.
sendDmx
(
"192.168.94.3"
,
0
,
0
,
rgbw_
.
getPixels
().
getData
(),
16
);
if
(
artnet_
->
sendDmx
(
"192.168.94.244"
,
0
,
0
,
rgbw_
.
getPixels
().
getData
(),
16
)
==
-
3
)
{
setup_artnet
();
}
sender_
->
sendMessage
(
m
);
sender_
->
sendMessage
(
m_height
);
...
...
@@ -303,7 +326,8 @@ class FilterManager
ofImage
rgbw_
;
private:
ofxArtnet
artnet_
;
std
::
string
my_artnet_ip_
;
std
::
unique_ptr
<
ofxArtnet
>
artnet_
;
std
::
vector
<
CropFilter
*>
filters_
;
ofxOscSender
*
sender_
;
...
...
src/ofxCloudLib/Cropper.hpp
View file @
50f3b070
...
...
@@ -27,7 +27,6 @@ class Cropper
void
draw
()
{
ofSetColor
(
0
,
255
,
0
,
100
);
ofNoFill
();
ofSetBoxResolution
(
2
);
...
...
src/ofxCloudLib/Merger.hpp
View file @
50f3b070
...
...
@@ -78,7 +78,6 @@ class Merger
scene_model_
.
disableMaterials
();
scene_model_
.
disableTextures
();
if
(
marqueurs_model_
.
hasMeshes
())
{
std
::
cout
<<
"marqueurs_model_ #meshes: "
<<
marqueurs_model_
.
getNumMeshes
()
<<
std
::
endl
;
}
...
...
@@ -129,7 +128,7 @@ class Merger
ofSetColor
(
255
,
255
,
255
,
100
);
ofRotateDeg
(
-
180
,
1
,
0
,
0
);
// ceci aaligne le modele avec le cloud
ofRotateYDeg
(
90
);
// ceci aaligne le modele avec le cloud
// ofRotateXDeg(180); // ceci aaligne le modele avec le cloud
//
git pu
ofRotateXDeg(180); // ceci aaligne le modele avec le cloud
ofScale
(
250
);
if
(
wireframe_models_
)
{
...
...
src/ofxCloudLib/ParsedParameterGroup.hpp
View file @
50f3b070
...
...
@@ -14,7 +14,7 @@ class ParsedParameterGroup : public ofParameterGroup
{
string
name
=
e
->
getName
();
boost
::
replace_all
(
name
,
" "
,
" "
);
std
::
cout
<<
"stored "
<<
name
<<
std
::
endl
;
//
std::cout << "stored " << name << std::endl;
parameter_to_string_mapping_
[
e
]
=
name
;
string_to_parameter_mapping_
[
name
]
=
e
;
}
...
...
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