Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
1fdcdb59
Commit
1fdcdb59
authored
Oct 02, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
picking multiple model by shooting ray and blinking
parent
93472912
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
41 deletions
+159
-41
ui_extra_models.js
js/ui_extra_models.js
+55
-3
ui_init.js
js/ui_init.js
+47
-13
x3dom_init.js
js/x3dom_init.js
+57
-25
No files found.
js/ui_extra_models.js
View file @
1fdcdb59
...
...
@@ -586,7 +586,6 @@ function manualposor_rotate_glued(){
var
AA
=
q
.
toAxisAngle
();
var
new_rot
=
AA
[
0
].
toString
()
+
" "
+
AA
[
1
];
var
tra1
=
MPR_PO
.
translation
.
split
(
","
);
tra1
=
new
x3dom
.
fields
.
SFVec3f
(
tra1
[
0
],
tra1
[
1
],
tra1
[
2
]);
...
...
@@ -595,12 +594,12 @@ function manualposor_rotate_glued(){
var
tra2
=
rv2
.
add
(
dR
.
multMatrixVec
(
tra1
.
subtract
(
rv1
)));
console
.
log
(
"check 2: "
+
tra2
.
toString
());
//
console.log("check 2: "+tra2.toString());
//var new_tra = dR.multMatrixVec(tra);
new_tra
=
[
tra2
.
x
,
tra2
.
y
,
tra2
.
z
].
join
(
","
);
console
.
log
(
new_tra
);
//
console.log(new_tra);
tmptransform
.
attr
(
"rotation"
,
new_rot
);
//tmptransform.attr("translation",new_tra);
...
...
@@ -688,9 +687,62 @@ function manualposor_unblink(){
}
function
manualposor_init_shootrays
(
x
,
y
){
MPR
.
counter
=
1
;
MPR
.
x
=
x
;
MPR
.
y
=
y
;
}
function
manualposor_shootrays
(){
var
r1
=
$
(
".mpr_r1[name=r1]:checked"
);
var
r2
=
$
(
".mpr_r2[name=r2]:checked"
);
if
(
MPR
.
counter
==
1
){
if
(
r2
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r2
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
-
1
);
}
//Scene.element.runtime.enterFrame();
}
else
if
(
MPR
.
counter
==
2
){
var
ray1
=
Scene
.
element
.
runtime
.
shootRay
(
MPR
.
x
,
MPR
.
y
);
console
.
log
(
ray1
);
if
(
r1
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r1
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
-
1
);
}
}
else
if
(
MPR
.
counter
==
3
){
var
ray2
=
Scene
.
element
.
runtime
.
shootRay
(
MPR
.
x
,
MPR
.
y
);
console
.
log
(
ray2
);
MPR
.
counter
=
0
;
}
if
(
MPR
.
counter
!=
0
){
console
.
log
(
"Counter: "
+
MPR
.
counter
);
MPR
.
counter
++
;
setTimeout
(
function
(){
var
r1
=
$
(
".mpr_r1[name=r1]:checked"
);
if
(
r1
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r1
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
0
);
}
if
(
r2
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r2
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
0
);
}
},
10
);
}
}
...
...
js/ui_init.js
View file @
1fdcdb59
...
...
@@ -91,6 +91,13 @@ var AUTOCOLORS_COUNTER = 0;
var
MARKER_PREFIX
=
"my-sph-"
;
// Manual Position & Orientation mode
var
MPR
=
{
counter
:
0
,
x
:
null
,
y
:
null
};
// no comments
function
parseURL
(){
var
parameters
=
location
.
href
.
replace
(
/
\?
/ig
,
"&"
).
split
(
"&"
);
...
...
@@ -427,10 +434,16 @@ function deep_init(){
//x3dom_testbox();
x3dom_setUpRight
();
if
(
SETTINGS
.
manualposor
){
manualposor_shootrays
();
manualposor_rotate_glued
();
}
// shoot ray here
}
if
(
!
Scene
.
_X3DOM_SCENE_INIT_DONE
&&
(
cnt
==
0
)){
...
...
@@ -447,6 +460,11 @@ function deep_init(){
}
// loading extra models?
if
(
Scene
.
_X3DOM_SCENE_INIT_DONE
&&
(
cnt
!=
0
)){
Scene
.
_X3DOM_SCENE_INIT_DONE
=
false
;
}
};
}
...
...
@@ -571,24 +589,33 @@ function x3d_events(){
Scene
.
_ctrlKey
=
true
;
var
x
,
y
,
z
;
var
dist
=
1111
;
if
(
!
SETTINGS
.
manualposor
){
var
mouse
=
x3dom_getXYPosOr
(
e
.
path
[
0
].
mouse_drag_x
,
e
.
path
[
0
].
mouse_drag_y
,
false
);
var
x
,
y
,
z
;
var
dist
=
1111
;
if
(
mouse
.
d_xz
!=
null
){
var
mouse
=
x3dom_getXYPosOr
(
e
.
path
[
0
].
mouse_drag_x
,
e
.
path
[
0
].
mouse_drag_y
,
false
);
dist
=
parseFloat
(
mouse
.
d_xz
);
if
(
mouse
.
d_xz
!=
null
){
X3DOMObject
.
Marker
.
place
(
mouse
.
x
,
mouse
.
y
,
mouse
.
z
,
"sliding_sphere"
);
dist
=
parseFloat
(
mouse
.
d_xz
);
if
(
Scene
.
highlighted_marker_index
==
null
)
{
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
0
);
}
X3DOMObject
.
Marker
.
place
(
mouse
.
x
,
mouse
.
y
,
mouse
.
z
,
"sliding_sphere"
);
if
(
Scene
.
highlighted_marker_index
==
null
)
{
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
0
);
}
}
Map
.
marker
.
placeSlidingMarker
(
mouse
.
a
,
dist
);
}
else
{
// place align marker here
}
Map
.
marker
.
placeSlidingMarker
(
mouse
.
a
,
dist
);
/*
// Debugging
...
...
@@ -642,10 +669,17 @@ function x3d_events(){
Scene
.
_ctrlKey
=
false
;
//remove on keydown?
X3DOMObject
.
Marker
.
place
(
0
,
0
,
0
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
-
1
);
if
(
!
SETTINGS
.
manualposor
){
Map
.
marker
.
removeSlidingMarker
();
X3DOMObject
.
Marker
.
place
(
0
,
0
,
0
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
-
1
);
Map
.
marker
.
removeSlidingMarker
();
}
else
{
// place align marker disable here
}
}
...
...
js/x3dom_init.js
View file @
1fdcdb59
...
...
@@ -272,6 +272,8 @@ X3DOMObject.prototype.ShapeEvents = function(){
inlines
.
each
(
function
(){
console
.
log
(
"binding inline: "
+
$
(
this
).
attr
(
"name"
));
if
(
$
(
this
).
attr
(
"name"
)
!=
"back"
){
var
shapes
=
$
(
this
).
find
(
"Shape"
);
...
...
@@ -295,42 +297,60 @@ X3DOMObject.prototype.ShapeEvents = function(){
X3DOMObject
.
Shape
=
function
(
element
){
this
.
_elem
=
element
this
.
_clearEvents
();
this
.
_registerEvents
();
}
X3DOMObject
.
Shape
.
prototype
.
_clearEvents
=
function
(){
$
(
this
.
_elem
).
off
(
"mousemove"
);
$
(
this
.
_elem
).
off
(
"click"
);
$
(
this
.
_elem
).
off
(
"mouseover"
);
$
(
this
.
_elem
).
off
(
"mouseout"
);
}
X3DOMObject
.
Shape
.
prototype
.
_registerEvents
=
function
(){
var
self
=
Scene
;
$
(
this
.
_elem
).
on
(
"mousemove"
,
function
(
e
){
var
x
=
e
.
originalEvent
.
worldX
;
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
if
(
!
SETTINGS
.
manualposor
){
var
x
=
e
.
originalEvent
.
worldX
;
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
var
xyz
=
zNear_bug_correction
([
x
,
y
,
z
]);
x
=
xyz
[
0
];
y
=
xyz
[
1
];
z
=
xyz
[
2
];
// (not used atm) store x3dom event to use in normal events
self
.
_stored_x3dom_event
=
e
.
originalEvent
;
var
xyz
=
zNear_bug_correction
([
x
,
y
,
z
]);
if
(
self
.
_ctrlKey
||
SETTINGS
.
pointer
){
x
=
xyz
[
0
];
y
=
xyz
[
1
];
z
=
xyz
[
2
];
// place pointer marker
X3DOMObject
.
PointerMarker
.
updatePars
();
// (not used atm) store x3dom event to use in normal events
self
.
_stored_x3dom_event
=
e
.
originalEvent
;
X3DOMObject
.
Marker
.
place
(
x
,
y
,
z
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
0
)
;
if
(
self
.
_ctrlKey
||
SETTINGS
.
pointer
)
{
}
else
{
// place pointer marker
X3DOMObject
.
PointerMarker
.
updatePars
();
// place at 0,0,0 and hide
X3DOMObject
.
Marker
.
place
(
0
,
0
,
0
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
-
1
);
X3DOMObject
.
Marker
.
place
(
x
,
y
,
z
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
0
);
}
}
else
{
// place at 0,0,0 and hide
X3DOMObject
.
Marker
.
place
(
0
,
0
,
0
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
-
1
);
// for align marker? do nothing
}
...
...
@@ -366,17 +386,29 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
if
(
self
.
_ctrlKey
){
var
x
=
e
.
originalEvent
.
worldX
;
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
if
(
!
SETTINGS
.
manualposor
){
var
xyz
=
zNear_bug_correction
([
x
,
y
,
z
]);
var
x
=
e
.
originalEvent
.
worldX
;
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
x
=
xyz
[
0
];
y
=
xyz
[
1
];
z
=
xyz
[
2
];
var
xyz
=
zNear_bug_correction
([
x
,
y
,
z
]);
x
=
xyz
[
0
];
y
=
xyz
[
1
];
z
=
xyz
[
2
];
X3DOMObject
.
createNewMarker
(
x
,
y
,
z
);
}
else
{
// align marker
var
lx
=
e
.
originalEvent
.
layerX
;
var
ly
=
e
.
originalEvent
.
layerY
;
manualposor_init_shootrays
(
lx
,
ly
);
X3DOMObject
.
createNewMarker
(
x
,
y
,
z
);
}
}
...
...
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