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
Show 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,6 +589,8 @@ function x3d_events(){
Scene
.
_ctrlKey
=
true
;
if
(
!
SETTINGS
.
manualposor
){
var
x
,
y
,
z
;
var
dist
=
1111
;
...
...
@@ -590,6 +610,13 @@ function x3d_events(){
Map
.
marker
.
placeSlidingMarker
(
mouse
.
a
,
dist
);
}
else
{
// place align marker here
}
/*
// Debugging
console.log("Canvas event:");
...
...
@@ -642,11 +669,18 @@ function x3d_events(){
Scene
.
_ctrlKey
=
false
;
//remove on keydown?
if
(
!
SETTINGS
.
manualposor
){
X3DOMObject
.
Marker
.
place
(
0
,
0
,
0
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
-
1
);
Map
.
marker
.
removeSlidingMarker
();
}
else
{
// place align marker disable here
}
}
},
true
);
...
...
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,16 +297,28 @@ 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
){
if
(
!
SETTINGS
.
manualposor
){
var
x
=
e
.
originalEvent
.
worldX
;
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
...
...
@@ -334,6 +348,12 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
}
}
else
{
// for align marker? do nothing
}
/*
if (!SETTINGS.verticaldrag&&Scene.draggedMarker){
...
...
@@ -366,6 +386,8 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
if
(
self
.
_ctrlKey
){
if
(
!
SETTINGS
.
manualposor
){
var
x
=
e
.
originalEvent
.
worldX
;
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
...
...
@@ -378,6 +400,16 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
X3DOMObject
.
createNewMarker
(
x
,
y
,
z
);
}
else
{
// align marker
var
lx
=
e
.
originalEvent
.
layerX
;
var
ly
=
e
.
originalEvent
.
layerY
;
manualposor_init_shootrays
(
lx
,
ly
);
}
}
/*
...
...
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