adds obj and obj+mtl support

This commit is contained in:
buttle 2021-04-04 18:55:10 +02:00
parent 38be97bec3
commit 50c78468fa
5 changed files with 30 additions and 9 deletions

View File

@ -6,12 +6,14 @@ Built using Vue, based on threejs.
## Install ## Install
This module requires the [Omeka-S-module-ArchiveRepertory] to be installed.
``` ```
cd ./modules cd ./modules
https://git.hangar.org/arcHIVE-tech/3Drenderer/archive/main.zip https://git.hangar.org/arcHIVE-tech/3D-Renderer/archive/main.zip
unzip main.zip unzip main.zip
mv renderviewer/ Render3D
``` ```
### Omeka global settings ### Omeka global settings
Add these to the `Allowed media types` Add these to the `Allowed media types`
@ -23,7 +25,7 @@ application/json
Add these to the `Allowed file extensions` Add these to the `Allowed file extensions`
``` ```
gltf, bin, json gltf, bin, json, obj, mtl
``` ```
## LISENCE ## LISENCE
@ -36,4 +38,5 @@ The 3D render feature is imported from [Vue-3d-model].
[3D Renderer]: https://git.hangar.org/arcHIVE-tech/Render3D [3D Renderer]: https://git.hangar.org/arcHIVE-tech/Render3D
[Vue-3d-model]: https://github.com/hujiulong/vue-3d-model [Vue-3d-model]: https://github.com/hujiulong/vue-3d-model
[Omeka S]: https://omeka.org/s [Omeka S]: https://omeka.org/s
[Omeka-S-module-ArchiveRepertory]: https://gitlab.com/Daniel-KM/Omeka-S-module-ArchiveRepertory
[MIT]: http://opensource.org/licenses/MIT [MIT]: http://opensource.org/licenses/MIT

View File

@ -1,5 +1,5 @@
[info] [info]
name = "Render3D" name = "3D Renderer"
description = "Renders 3D" description = "Renders 3D"
tags = "" tags = ""
license = "MIT" license = "MIT"

View File

@ -34,7 +34,7 @@ class Render3D extends AbstractBlockLayout
} }
public function getLabel() { public function getLabel() {
return 'Render 3D'; return '3D Renderer';
} }
public function form(PhpRenderer $view, public function form(PhpRenderer $view,

View File

@ -1,8 +1,7 @@
<div class="3d-model-wrap" style="position:relative;"> <div class="3d-model-wrap" style="position:relative;">
<?php <?php
$this->headScript()->appendFile($this->assetUrl('vendor/vue-3d-model/vue.js', $this->headScript()->appendFile($this->assetUrl('vendor/vue/vue.js', 'Render3D'));
'Render3D'));
$this->headScript()->appendFile($this->assetUrl('vendor/vue-3d-model/vue-3d-model.umd.js', $this->headScript()->appendFile($this->assetUrl('vendor/vue-3d-model/vue-3d-model.umd.js',
'Render3D')); 'Render3D'));
if ($title !== false && $title !== "") { if ($title !== false && $title !== "") {
@ -24,17 +23,36 @@ console.log(<?= json_encode($urls, JSON_UNESCAPED_SLASHES) ?>)
</style> </style>
<div class="3d-model-wrap"> <div class="3d-model-wrap">
<?php if ($model_type == "gltf") { ?> <?php if ($model_type == "gltf") { ?>
<div id="<?= $id ?>"> <div id="<?= $id ?>">
<model-gltf <model-gltf
src="<?= $urls[0]; ?>" src="<?= $urls[0]; ?>"
@on-mousemove="onMouseMove"> @on-mousemove="onMouseMove"
>
</model-gltf> </model-gltf>
</div> </div>
<?php } ?> <?php } ?>
<?php if ($model_type == "obj") { ?>
<?php if ($model_type == "obj") { ?>
<div id="<?= $id ?>">
<model-obj
src="<?= $urls[0]; ?>"
>
</model-obj>
</div>
<?php } ?> <?php } ?>
<?php if ($model_type == "obj+mtl") { ?>
<div id="<?= $id ?>">
<model-obj
src="<?= $urls[0]; ?>"
mtl="<?= $urls[1]; ?>"
>
</model-obj>
</div>
<?php } ?>
</div> </div>
<script> <script>