adds example JSON model

This commit is contained in:
buttle 2021-06-13 14:28:28 +02:00
parent f6eeae77c5
commit 3afcc0af56
3 changed files with 403 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ BASE_DIR = os.path.abspath(
'../') '../')
) )
OBJECT_DIR = os.path.join(BASE_DIR, 'objects') OBJECT_DIR = os.path.join(BASE_DIR, 'objects')
OBJECT_TYPES = ['gltf', 'glb', 'obj', 'fbx', 'stl', 'dae'] OBJECT_TYPES = ['gltf', 'glb', 'obj', 'fbx', 'stl', 'dae', 'json']
def get_directory_content(dir_path): def get_directory_content(dir_path):
content = [] content = []
@ -107,6 +107,11 @@ def get_object(file_path, result={}):
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects{object_path}")
return result return result
if extension == 'json':
result['type'] = "json"
object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}")
return result
return None return None

View File

@ -57,7 +57,15 @@
> >
</model-collada> </model-collada>
%end %end
%if object['type'] == "json":
<model-three
:backgroundAlpha="0"
@on-load="onLoad"
:rotation="rotation"
src="{{ object['urls'][0] }}"
>
</model-three>
%end
</div> </div>
</div> </div>