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
f1b48c14
Commit
f1b48c14
authored
Jul 29, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ download model with textures as a single zip
parent
5746e1ca
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
26 deletions
+78
-26
download.php
download.php
+54
-0
ui.css
js/ui.css
+13
-21
ui_menu.js
js/ui_menu.js
+5
-1
viewer.html
viewer.html
+6
-4
No files found.
download.php
0 → 100644
View file @
f1b48c14
<?php
/*
Copyright (C) 2017 Elphel Inc.
SPDX-License-Identifier: AGPL-3.0+
https://www.elphel.com
*/
// https://stackoverflow.com/questions/1061710/php-zip-files-on-the-fly
// * solution for ZipArchive worked only from a command line
// * solution that worked: command line zip
// contstants
$TEXTURE_EXTENSIONS
=
[
'png'
,
'jpeg'
,
'jpg'
,
'tif'
,
'tiff'
,
'gif'
];
// check if file parameter is specified
if
(
!
isset
(
$_GET
[
'file'
]))
die
(
"-1"
);
$file
=
$_GET
[
'file'
];
$patterns
=
[
'/(\.)+\//'
,
'/^\//'
];
$replacements
=
[
''
,
''
];
// check if file exists
if
(
!
is_file
(
$file
))
die
(
"-2"
);
if
(
substr
(
$file
,
-
4
)
!=
".x3d"
)
die
(
"-3"
);
$pathinfo
=
pathinfo
(
$file
);
$path
=
$pathinfo
[
'dirname'
];
$tmp
=
explode
(
"/"
,
$path
);
$zipfile
=
$tmp
[
1
]
.
"_"
.
$tmp
[
2
]
.
".zip"
;
// alright, there's this file
$contents
=
file_get_contents
(
$file
);
// extract file list
preg_match_all
(
'/url="([^\s]+('
.
implode
(
'|'
,
$TEXTURE_EXTENSIONS
)
.
'))"/i'
,
$contents
,
$matches
);
// make a string
foreach
(
$matches
[
1
]
as
$v
){
$file
.=
"
$path
/
$v
"
;
}
$zipped_data
=
`zip -qj - $file `
;
header
(
'Content-type: application/zip'
);
header
(
'Content-Disposition: attachment; filename="'
.
$zipfile
.
'"'
);
echo
$zipped_data
;
?>
\ No newline at end of file
js/ui.css
View file @
f1b48c14
...
@@ -187,10 +187,10 @@ html, body, #x3d_wrapper {
...
@@ -187,10 +187,10 @@ html, body, #x3d_wrapper {
height
:
25px
;
height
:
25px
;
}
}
#exit_button
{
#exit_button
,
#align_button
,
#align_tr_button
,
#download_button
{
background-image
:
url('images/ic_exit_to_app_black_48dp_1x.png')
;
background-size
:
32px
32px
;
background-size
:
32px
32px
;
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
background-position
:
center
;
background-color
:
white
;
background-color
:
white
;
width
:
32px
;
width
:
32px
;
...
@@ -200,37 +200,29 @@ html, body, #x3d_wrapper {
...
@@ -200,37 +200,29 @@ html, body, #x3d_wrapper {
margin-bottom
:
2px
;
margin-bottom
:
2px
;
}
}
#exit_button
{
background-image
:
url('images/ic_exit_to_app_black_48dp_1x.png')
;
}
#download_button
{
background-image
:
url('images/ic_file_download_black_48dp_1x.png')
;
background-size
:
26px
26px
;
}
#align_button
{
#align_button
{
background-image
:
url('images/ic_explore_black_48dp_1x.png')
;
background-image
:
url('images/ic_explore_black_48dp_1x.png')
;
background-size
:
32px
32px
;
background-repeat
:
no-repeat
;
background-color
:
white
;
width
:
32px
;
height
:
32px
;
border
:
0px
solid
white
;
border-radius
:
2px
;
margin-bottom
:
2px
;
}
}
#align_tr_button
{
#align_tr_button
{
background-image
:
url('images/ic_horizon_black_48dp_1x.png')
;
background-image
:
url('images/ic_horizon_black_48dp_1x.png')
;
background-size
:
32px
32px
;
background-repeat
:
no-repeat
;
background-color
:
white
;
width
:
32px
;
height
:
32px
;
border
:
0px
solid
white
;
border-radius
:
2px
;
margin-bottom
:
2px
;
}
}
#exit_button
:hover
{
#exit_button
:hover
{
background-color
:
rgba
(
240
,
150
,
150
,
1
);
background-color
:
rgba
(
240
,
150
,
150
,
1
);
}
}
#align_button
:hover
,
#align_tr_button
:hover
{
#align_button
:hover
,
#align_tr_button
:hover
,
#download_button
:hover
{
/* background-image:url('images/align.png'); */
/* background-image:url('images/align.png'); */
background-color
:
rgba
(
240
,
240
,
240
,
1
);
background-color
:
rgba
(
240
,
240
,
240
,
1
);
}
}
...
...
js/ui_menu.js
View file @
f1b48c14
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Copyright (C) 2017 Elphel Inc.
Copyright (C) 2017 Elphel Inc.
License: GPLv3
SPDX-License-Identifier: GPL-3.0+
https://www.elphel.com
https://www.elphel.com
...
@@ -67,6 +67,10 @@ function menu_init(){
...
@@ -67,6 +67,10 @@ function menu_init(){
window
.
location
.
href
=
origin
+
path
;
window
.
location
.
href
=
origin
+
path
;
});
});
$
(
"#download_button"
).
on
(
"click"
,
function
(){
window
.
location
.
href
=
"download.php?file="
+
SETTINGS
.
files
.
x3d
;
});
// changing a checkbox will not close menu
// changing a checkbox will not close menu
menu
.
on
(
'click'
,
function
(
e
){
menu
.
on
(
'click'
,
function
(
e
){
var
test
=
$
(
e
.
target
).
hasClass
(
"donothide"
);
var
test
=
$
(
e
.
target
).
hasClass
(
"donothide"
);
...
...
viewer.html
View file @
f1b48c14
...
@@ -55,9 +55,9 @@
...
@@ -55,9 +55,9 @@
<x3d
id=
"x3d_id"
width=
'1600px'
height=
'800px'
showProgress=
"true"
showStat=
"false"
showLog=
"false"
disableDoubleClick=
"true"
keysEnabled=
"true"
>
<x3d
id=
"x3d_id"
width=
'1600px'
height=
'800px'
showProgress=
"true"
showStat=
"false"
showLog=
"false"
disableDoubleClick=
"true"
keysEnabled=
"true"
>
<scene>
<scene>
<navigationInfo
id=
"navInfo"
type=
'"examine"'
speed=
'0.01'
></navigationInfo>
<navigationInfo
id=
"navInfo"
type=
'"examine"'
speed=
'0.01'
></navigationInfo>
<
Viewpoint
fieldOfView=
'1'
position=
'0 0 0'
orientation=
'0 0 1 0'
></Viewpoint
>
<
!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' ></Viewpoint>--
>
<!-- in x3dom 1.7.2 - big zNear does not work properly -->
<!-- in x3dom 1.7.2 - big zNear does not work properly -->
<
!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' zNear='2'></Viewpoint>--
>
<
Viewpoint
fieldOfView=
'1'
position=
'0 0 0'
orientation=
'0 0 1 0'
zNear=
'3'
></Viewpoint
>
<!-- <group>
<!-- <group>
<inline name="back" namespacename="back" url="models/m1/v1/background.x3d"/>
<inline name="back" namespacename="back" url="models/m1/v1/background.x3d"/>
</group>-->
</group>-->
...
@@ -70,9 +70,10 @@
...
@@ -70,9 +70,10 @@
<div
id=
'crosshair_h'
class=
'crosshair'
></div>
<div
id=
'crosshair_h'
class=
'crosshair'
></div>
<div
id=
'crosshair_v'
class=
'crosshair'
></div>
<div
id=
'crosshair_v'
class=
'crosshair'
></div>
<div
id=
'help_wrapper'
>
<div
id=
'help_wrapper'
>
<div
id=
'menu_button'
></div>
<div
id=
'help_button'
>
?
</div>
<div
id=
'exit_button'
title=
'Exit to models index'
></div>
<div
id=
'exit_button'
title=
'Exit to models index'
></div>
<div
id=
'help_button'
>
?
</div>
<div
id=
'download_button'
title=
'Download 3d model'
></div>
<div
id=
'menu_button'
></div>
<div
id=
'align_button'
title=
'Run alignment algorithm for camera heading and location using markers.
<div
id=
'align_button'
title=
'Run alignment algorithm for camera heading and location using markers.
Instructions:
Instructions:
1. Use approximate location control on the map to change initial approximation for the algorithm.
1. Use approximate location control on the map to change initial approximation for the algorithm.
...
@@ -83,6 +84,7 @@ Instructions:
...
@@ -83,6 +84,7 @@ Instructions:
<!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>-->
<!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>-->
<div
id=
'align_tr_button'
title=
'Align tilt and roll'
class=
'experimental'
></div>
<div
id=
'align_tr_button'
title=
'Align tilt and roll'
class=
'experimental'
></div>
</div>
</div>
<div
id=
'info-wrapper'
>
<div
id=
'info-wrapper'
>
<div
id=
'window-info'
></div>
<div
id=
'window-info'
></div>
<div
id=
'window-markinfo'
></div>
<div
id=
'window-markinfo'
></div>
...
...
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