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

122 lines
2.1 KiB
PHTML
Raw Normal View History

2021-04-04 17:47:14 +02:00
<div class="3d-model-wrap" style="position:relative;">
<?php
2021-04-04 18:55:10 +02:00
$this->headScript()->appendFile($this->assetUrl('vendor/vue/vue.js', 'Render3D'));
2021-04-04 17:47:14 +02:00
$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>
2021-05-31 20:09:46 +02:00
2021-04-04 17:47:14 +02:00
<div class="3d-model-wrap">
2021-05-31 20:09:46 +02:00
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
2021-04-04 18:55:10 +02:00
2021-04-04 17:47:14 +02:00
<?php if ($model_type == "gltf") { ?>
<div id="<?= $id ?>">
<model-gltf
src="<?= $urls[0]; ?>"
2021-04-04 18:55:10 +02:00
@on-mousemove="onMouseMove"
>
2021-04-04 17:47:14 +02:00
</model-gltf>
</div>
<?php } ?>
2021-04-04 18:55:10 +02:00
2021-04-04 17:47:14 +02:00
<?php if ($model_type == "obj") { ?>
2021-04-04 18:55:10 +02:00
<div id="<?= $id ?>">
<model-obj
src="<?= $urls[0]; ?>"
>
</model-obj>
</div>
<?php } ?>
2021-04-04 17:47:14 +02:00
2021-04-04 18:55:10 +02:00
<?php if ($model_type == "obj+mtl") { ?>
<div id="<?= $id ?>">
<model-obj
src="<?= $urls[0]; ?>"
mtl="<?= $urls[1]; ?>"
>
</model-obj>
</div>
2021-04-04 17:47:14 +02:00
<?php } ?>
2021-04-09 10:05:52 +02:00
<?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 } ?>
2021-05-31 20:09:46 +02:00
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
</div>
<?php } ?>
2021-04-04 17:47:14 +02:00
</div>
<script>
new Vue({
el: "#<?= $id ?>"
})
</script>
</div>