Skip to content

Commit

Permalink
Initial Voyager 3D support for .glb files
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Aug 7, 2024
1 parent 32864e5 commit b2a37ca
Show file tree
Hide file tree
Showing 3 changed files with 299 additions and 0 deletions.
41 changes: 41 additions & 0 deletions previewers/betatest/VoyagerPreview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE HTML>
<html>

<head>
<meta charset="utf-8">
<title class="voyagerPreviewText">Voyager 3D Preview</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="css/preview.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title class="voyagerPreviewText">Voyager Explorer v0.12.3</title>
<link href="https://3d-api.si.edu/resources/fonts/fonts.css" rel="stylesheet">
<script type="text/javascript" src="js/voyager.js"></script>
<style>
body {
background: #303030;
}
</style>
</head>

<body class="container">
<main> <img id='logo' alt='Site Logo'>
<h1 class="page-title voyoagerPreviewText">Voyager 3D Preview</h1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview' width='1200'>
<!--voyager-explorer resourceRoot="https://3d-api.si.edu/resources/" root="http://ec2-3-238-245-253.compute-1.amazonaws.com/Voyager/" model="388?gbrecs=true&until=2024-08-10T06:47:04.074&user=dataverseAdmin&method=GET&token=df9f31ce5231890a7f88499c06886d1c4c5e6fe15a46ba300e817e806252632b9a3f848b31365e0c453ac4ecb20c23486b701c86bf49288e8e7eb490f84d210c"></voyager-explorer!-->
<voyager-explorer resourceRoot="https://3d-api.si.edu/resources/"></voyager-explorer>
</div>
</div>
</main>
</body>

</html>
19 changes: 19 additions & 0 deletions previewers/betatest/js/voyager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(document).ready(function() {
startPreview(false);
});

function translateBaseHtmlPage() {
var videoPreviewText = $.i18n("videoPreviewText");
$('.videoPreviewText').text(videoPreviewText);
}

function writeContent(fileUrl, file, title, authors) {
// Currently the styling of Voyager hides this info anyway.
// addStandardPreviewHeader(file, title, authors);
const lastIndexOfChar = fileUrl.lastIndexOf("/");
const rootUrl = fileUrl.substring(0, lastIndexOfChar + 1);
const fileName = fileUrl.substring(lastIndexOfChar + 1);
console.log(fileUrl);
$("voyager-explorer").attr("root", rootUrl).attr("model", fileName);
$.getScript("lib/voyager-explorer.min.v0.17.0.gdcc.js");
}
239 changes: 239 additions & 0 deletions previewers/betatest/lib/voyager-explorer.min.v0.17.0.gdcc.js

Large diffs are not rendered by default.

0 comments on commit b2a37ca

Please sign in to comment.