65 lines
1.2 KiB
PHTML
65 lines
1.2 KiB
PHTML
<div class="3d-model-wrap" style="position:relative;">
|
|
|
|
<?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">
|
|
|
|
<?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 } ?>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
new Vue({
|
|
el: "#<?= $id ?>"
|
|
})
|
|
</script>
|
|
|
|
</div>
|