three.js 3d模型没有出现

时间:2017-07-27 17:48:20

标签: javascript html three.js

我尝试了之前看到的所有内容,但它没有解决问题。我无法显示3D模型。许多人向我提到这是相机的一个问题,但似乎无法修复它。任何帮助将不胜感激:)

<html>
  <head>
    <title>My first Three.js app</title>
    <style>canvas { width: 100%; height: 100% }</style>
  </head>
  <body>
    <script src="O:/FirstPublishedGame/FINAL-STEPS/levels/ForLevel3+/three.js-master/build/Three.js"></script>
    <script src="O:/FirstPublishedGame/FINAL-STEPS/levels/ForLevel3+/three.js-master/src/ob"></script>
    <script>

    var scene = new THREE.Scene();
    var camera = new THREE.PerspectiveCamera( 75, 
    window.innerWidth/window.innerHeight, 0.1, 1000 );
    var element = document.getElementById("container");


    var renderer = new THREE.WebGLRenderer( { alpha: true } );
    renderer.setSize( window.innerWidth, window.innerHeight );
    element.appendChild( renderer.domElement );

    var loader = new THREE.OBJLoader();
    loader.load(
        'O:/FirstPublishedGame/FINAL-STEPS/levels/ForLevel3+/three.js-master/examples/obj/female02/female02.obj',
        function ( object ) {
            scene.add( object );
    });

    function render() {
        window.requestAnimationFrame( render );
        renderer.render( scene, camera );
    }

    render();

    </script>
  </body>
</html>

1 个答案:

答案 0 :(得分:0)

您需要一个id为容器的元素 - 尝试添加

import random

def random_different_sample(lower, upper, min_diff):
    while True:
        attempt = random.sample(range(lower, upper), 2)
        if abs(attempt[0]-attempt[1]) >= min_diff:
            return attempt

def random_different_sample_1(lower, upper, min_diff):
    attempt = random.sample(range(lower, upper), 2)
    if abs(attempt[0]-attempt[1]) >= min_diff:
        return attempt
    if attempt[0] > attempt[1]:
        attempt[0] += min_diff - (attempt[0] - attempt[1])
        while attempt[0] >= upper:
            attempt[0] -= 1
            attempt[1] -= 1
    else:
        attempt[1] += min_diff - (attempt[1] - attempt[0])
        while attempt[1] >= upper:
            attempt[0] -= 1
            attempt[1] -= 1
    return attempt

在你身体的开始。

否则你无法设置元素。