Fixed some transparency issue

This commit is contained in:
Thomas FORGIONE 2015-05-28 16:10:47 +02:00
parent aa77d182fd
commit ad8285db74
4 changed files with 18 additions and 7 deletions

View File

@ -10,6 +10,8 @@ all: Three Stats ThreeTools Bouncing Multisphere StreamingSimulator PrototypeToo
Three: Three:
cp three/three.min.js ../static/js/ cp three/three.min.js ../static/js/
$(CLOSURE) $(OPT) \
--js three/threex.transparency.js >> ../static/js/three.min.js
Stats: Stats:
cp three/stats.min.js ../static/js/ cp three/stats.min.js ../static/js/

View File

@ -19,4 +19,8 @@ while [[ $# > 0 ]]; do
done done
if [ -z "$output" ]; then
cat $args
else
cat $args > $output cat $args > $output
fi

View File

@ -26,12 +26,16 @@ function initPeachCastle(scene, collidableObjects, loader, static_path) {
object.material.side = THREE.DoubleSide; object.material.side = THREE.DoubleSide;
object.raycastable = true; object.raycastable = true;
if (object.material.name === 'Material.103_princess_peaches_cast') { if (object.material.name === 'Material.103_princess_peaches_cast') {
object.material.transparent = true; THREEx.Transparency.push(object);
} else if (object.material.name === 'Material.136_princess_peaches_cast') { } else if (object.material.name === 'Material.136_princess_peaches_cast') {
object.material.transparent = true; THREEx.Transparency.push(object);
object.material.opacity = 0.5; object.material.opacity = 0.5;
object.material.side = THREE.FrontSide;
object.raycastable = false; object.raycastable = false;
var newObj = object.clone();
newObj.material = object.material.clone();
newObj.material.side = THREE.BackSide;
scene.add(newObj);
} }
} }
}); });
@ -60,7 +64,7 @@ function initPeachCastle(scene, collidableObjects, loader, static_path) {
object.raycastable = true; object.raycastable = true;
if (object.material.name === 'Material.054_777F0E0B_c.bmp' || if (object.material.name === 'Material.054_777F0E0B_c.bmp' ||
object.material.name === 'Material.061_5C3492AB_c.bmp' ) { object.material.name === 'Material.061_5C3492AB_c.bmp' ) {
object.material.transparent = true; THREEx.Transparency.push(object);
} }
} }
}); });
@ -100,7 +104,7 @@ function initZeldaScene(scene, collidableObjects, loader, static_path) {
object.material.side = THREE.DoubleSide; object.material.side = THREE.DoubleSide;
object.raycastable = true; object.raycastable = true;
if (object.material.name === 'm0') { if (object.material.name === 'm0') {
object.material.transparent = true; THREEx.Transparency.push(object);
} }
} }
}); });
@ -223,7 +227,7 @@ function initBobombScene(scene, collidableObjects, loader, static_path) {
object.geometry.computeVertexNormals(); object.geometry.computeVertexNormals();
if (object.material.name === 'Material.071_574B138E_c.bmp' || if (object.material.name === 'Material.071_574B138E_c.bmp' ||
object.material.name === 'Material.070_41A41EE3_c.bmp') { object.material.name === 'Material.070_41A41EE3_c.bmp') {
object.material.transparent = true; THREEx.Transparency.push(object);
} }
} }

View File

@ -237,6 +237,7 @@ function render() {
renderer.setScissor(left, bottom, width, height); renderer.setScissor(left, bottom, width, height);
renderer.enableScissorTest(true); renderer.enableScissorTest(true);
renderer.setViewport(left, bottom, width, height); renderer.setViewport(left, bottom, width, height);
THREEx.Transparency.update(cameras.mainCamera());
renderer.render(scene, cameras.mainCamera()); renderer.render(scene, cameras.mainCamera());
// Remove borders of preview // Remove borders of preview