orbit and camera params
This commit is contained in:
		@@ -15,14 +15,14 @@
 | 
			
		||||
        const renderer = new THREE.WebGLRenderer({canvas});
 | 
			
		||||
 | 
			
		||||
        const fov = {{camera.fov}};
 | 
			
		||||
        const aspect = 2;  // the canvas default
 | 
			
		||||
        const near = 0.1;
 | 
			
		||||
        const far = 100;
 | 
			
		||||
        const aspect = {{camera.aspect}};  // the canvas default
 | 
			
		||||
        const near = {{camera.near}};
 | 
			
		||||
        const far = {{camera.far}};
 | 
			
		||||
        const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
 | 
			
		||||
        camera.position.set(0, 10, 20);
 | 
			
		||||
        camera.position.set({{camera.pos_x}}, {{camera.pos_y}}, {{camera.pos_z}});
 | 
			
		||||
 | 
			
		||||
        const controls = new OrbitControls(camera, canvas);
 | 
			
		||||
        controls.target.set(0, 5, 0);
 | 
			
		||||
        controls.target.set({{camera.orbit_x}}, {{camera.orbit_y}}, {{camera.orbit_z}});
 | 
			
		||||
        controls.update();
 | 
			
		||||
 | 
			
		||||
        const scene = new THREE.Scene();
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,8 @@ TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'index.
 | 
			
		||||
 | 
			
		||||
def simple_mustache(input_string, value_dict):
 | 
			
		||||
  output_string = copy.deepcopy(input_string)
 | 
			
		||||
  mustache_variables = re.findall(r"{{.*}}",output_string)
 | 
			
		||||
  mustache_variables = re.findall(r"{{.*?}}",output_string)
 | 
			
		||||
 | 
			
		||||
  for v_text in mustache_variables:
 | 
			
		||||
    v_name = v_text[2:-2]
 | 
			
		||||
    if '.' in v_name:
 | 
			
		||||
@@ -21,7 +22,16 @@ def simple_mustache(input_string, value_dict):
 | 
			
		||||
def obj2html(
 | 
			
		||||
  obj_path, output_html_path=None, 
 | 
			
		||||
  camera={
 | 
			
		||||
      "fov": 45
 | 
			
		||||
      "fov": 45,
 | 
			
		||||
      "aspect": 2,
 | 
			
		||||
      "near": 0.1,
 | 
			
		||||
      "far": 100,
 | 
			
		||||
      "pos_x": 0,
 | 
			
		||||
      "pos_y": 10,
 | 
			
		||||
      "pos_z": 20,
 | 
			
		||||
      "orbit_x": 0,
 | 
			
		||||
      "orbit_y": 5,
 | 
			
		||||
      "orbit_z": 0,
 | 
			
		||||
    },
 | 
			
		||||
  ):
 | 
			
		||||
  with  open(obj_path, "r") as f:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user