47 lines
988 B
PHTML
47 lines
988 B
PHTML
<div class="3d-model-wrap" style="position:relative;">
|
|
|
|
<?php
|
|
$this->headScript()->appendFile($this->assetUrl('vendor/vue-3d-model/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") { ?>
|
|
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<script>
|
|
new Vue({
|
|
el: "#<?= $id ?>"
|
|
})
|
|
</script>
|
|
|
|
</div>
|