refactor wit dot notation
This commit is contained in:
parent
85836c5434
commit
de5d67b2cf
@ -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 = {{fov}};
|
const fov = {{camera.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;
|
||||||
|
@ -4,7 +4,12 @@ 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, fov=45):
|
def obj2html(
|
||||||
|
obj_path, output_html_path=None,
|
||||||
|
camera={
|
||||||
|
"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,7 +19,7 @@ def obj2html(obj_path, output_html_path=None, fov=45):
|
|||||||
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))
|
html_string = html_string.replace("{{camera.fov}}", str(camera['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:
|
||||||
|
Loading…
Reference in New Issue
Block a user