0
class Game extends backbone.View
constructor: ->
@scene = new THREE.Scene()
@camera = new THREE.PerspectiveCamera 75, window.innerWidth/window.innerHeight, 1, 100000
@camera.position.z = 300
@scene.add @camera
@imgText = imgText = THREE.ImageUtils.loadTexture "/images/health.png"
imgText.wrapT = imgText.wrapS = THREE.RepeatWrapping
sphereMat = new THREE.MeshBasicMaterial {map: imgText}
@mesh = new THREE.Mesh new THREE.CylinderGeometry(100, 100, 200, 64, 1, true), sphereMat
@mesh.doubleSided = @mesh.flipSided = true
@mesh.frustumCulled = false
@scene.add @mesh
pl = new THREE.PointLight 0xFFFFFF
[pl.position.x, pl.position.y, pl.position.z] = [10, 50, 130]
@scene.add pl
@el = $ "body"
render: ->
@renderer = new THREE.WebGLRenderer()
@renderer.setSize window.innerWidth, window.innerHeight
$(@el).append @renderer.domElement
$(@el).mousewheel (event, delta) =>
@camera.position.z += delta
step: (delta) ->
@mesh.rotation.y += 1*
@renderer?.render @scene, @camera
獲得紋理消失/重現的一些奇怪問題。它就像整個物體消失了一段時間,然後從那裏回來。我附加了一個YouTube視頻。雙面圖形消失THREE.js中y軸上的對象旋轉
http://www.youtube.com/watch?v=aHh25O6I5Vs
就像它每次旋轉只能顯示一次紋理一樣。 – Pykedout 2012-08-12 12:52:19
絕對似乎是錯誤的或某事。如果我進入氣缸內部,則不存在此問題。 – Pykedout 2012-08-13 01:09:18
當我將材質的depthTest屬性設置爲false時,它會完全顯示紋理。當它進行右轉時(即使通過紋理的另一側)。 – Pykedout 2012-08-13 21:12:59