2013-02-20 75 views
0

我嘗試顯示一個sprite與三個js版本的r55,但屏幕上沒有任何東西。有人可以幫我找到錯誤嗎?我不是在本地加載東西以防止出現一些錯誤。我不明白爲什麼所有的3D物體都能正常工作,而不是紋理或者精靈。 感謝所有Threejs r55 sprite不會顯示

var startTime = Date.now(); 
var container = document.getElementById('container'); 
var camera, scene, renderer; 
var ambientlight,directionallight; 
var texturenuage, obj1; 

init();   
animate(); 

function init() { 

if (! Detector.webgl) Detector.addGetWebGLMessage(); 
scene = new THREE.Scene(); 

camera = new THREE.PerspectiveCamera(30, 901/727, 1, 1000); 
camera.position.x = 0; 
camera.position.y = 0; 
camera.position.z = 1000; 

ambientlight = new THREE.AmbientLight(0x220066); 
scene.add(ambientlight); 

directionallight = new THREE.DirectionalLight(0xff88aa); 
directionallight.position.set(40, 50, 100).normalize(); 
scene.add(directionallight); 


texturenuage = new THREE.ImageUtils.loadTexture('nuage1.png'); 
obj1 = new THREE.Sprite(new THREE.SpriteMaterial({ color: 0xff0000, map: texturenuage, alphaTest: 0.5 })) 
sprite.scale.set(381, 84, 1.0) 
sprite.position.set(100, 100, 0); 
sprite.position.normalize(); 
scene.add(obj1); 

renderer = new THREE.WebGLRenderer(); 

renderer.sortObjects = false; 
renderer.setSize(901, 727);  
container.appendChild(renderer.domElement); 
} 

function animate() { 
render(); 
requestAnimationFrame(animate); 
} 

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

回答