3D-Renderer-omeka-module/view/common/block-layout/_render-3d.phtml

121 lines
2.0 KiB
PHTML

<?php
$this->headScript()->appendFile($this->assetUrl('vendor/vue/vue.js', 'Render3D'));
$this->headScript()->appendFile($this->assetUrl('vendor/vue-3d-model/vue-3d-model.umd.js',
'Render3D'));
if ($title !== false && $title !== "") {
$title = sprintf('<p id="render-3d-title">%s</p>', $title);
} else {
$title = false;
}
?>
<script>
console.log(<?= json_encode($urls, JSON_UNESCAPED_SLASHES) ?>)
</script>
<style>
#<?= $id ?> {
height: <?= $height ?>px;
width: <?= $width ?>px;
}
</style>
<div class="3d-model-wrap archive-item-block">
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<?php if ($model_type == "gltf") { ?>
<div id="<?= $id ?>">
<model-gltf
src="<?= $urls[0]; ?>"
@on-mousemove="onMouseMove"
>
</model-gltf>
</div>
<?php } ?>
<?php if ($model_type == "obj") { ?>
<div id="<?= $id ?>">
<model-obj
src="<?= $urls[0]; ?>"
>
</model-obj>
</div>
<?php } ?>
<?php if ($model_type == "obj+mtl") { ?>
<div id="<?= $id ?>">
<model-obj
src="<?= $urls[0]; ?>"
mtl="<?= $urls[1]; ?>"
>
</model-obj>
</div>
<?php } ?>
<?php if ($model_type == "json") { ?>
<div id="<?= $id ?>">
<model-three
src="<?= $urls[0]; ?>"
>
</model-three>
</div>
<?php } ?>
<?php if ($model_type == "fbx") { ?>
<div id="<?= $id ?>">
<model-fbx
src="<?= $urls[0]; ?>"
>
</model-fbx>
</div>
<?php } ?>
<?php if ($model_type == "stl") { ?>
<div id="<?= $id ?>">
<model-stl
src="<?= $urls[0]; ?>"
>
</model-stl>
</div>
<?php } ?>
<?php if ($model_type == "dae") { ?>
<div id="<?= $id ?>">
<model-collada
src="<?= $urls[0]; ?>"
>
</model-collada>
</div>
<?php } ?>
<?php if ($model_type == "ply") { ?>
<div id="<?= $id ?>">
<model-ply
src="<?= $urls[0]; ?>"
>
</model-ply>
</div>
<?php } ?>
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
</div>
<?php } ?>
</div>
<script>
new Vue({
el: "#<?= $id ?>"
})
</script>