This commit is contained in:
nicolalandro 2021-11-14 09:15:05 +01:00
parent b07c5152bb
commit 85836c5434
2 changed files with 3 additions and 2 deletions

View File

@ -14,7 +14,7 @@
const canvas = document.querySelector('#c'); const canvas = document.querySelector('#c');
const renderer = new THREE.WebGLRenderer({canvas}); const renderer = new THREE.WebGLRenderer({canvas});
const fov = 45; const fov = {{fov}};
const aspect = 2; // the canvas default const aspect = 2; // the canvas default
const near = 0.1; const near = 0.1;
const far = 100; const far = 100;

View File

@ -4,7 +4,7 @@ import json
TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'index.html') TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'index.html')
def obj2html(obj_path, output_html_path=None): def obj2html(obj_path, output_html_path=None, fov=45):
with open(obj_path, "r") as f: with open(obj_path, "r") as f:
content = f.readlines() content = f.readlines()
content = '\n'.join(content) content = '\n'.join(content)
@ -14,6 +14,7 @@ def obj2html(obj_path, output_html_path=None):
with open(TEMPLATE_PATH, "r") as f: with open(TEMPLATE_PATH, "r") as f:
html_template = f.read() html_template = f.read()
html_string = html_template.replace("{{obj_3d}}", js_string) html_string = html_template.replace("{{obj_3d}}", js_string)
html_string = html_string.replace("{{fov}}", str(fov))
if output_html_path != None: if output_html_path != None:
with open(output_html_path, "w") as f: with open(output_html_path, "w") as f: