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

65 lines
1.2 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>
<div class="3d-model-wrap">
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-04 18:55:10 +02:00
2021-04-04 17:47:14 +02:00
</div>
<script>
new Vue({
el: "#<?= $id ?>"
})
</script>
</div>