Permalink
Browse files

Applied @alteredq's sprite removal bugfix.

  • Loading branch information...
1 parent 1c26dd2 commit 78fb8ac6f865514f5071a86035faacf5818ca4c7 @mrdoob mrdoob committed Jul 2, 2011
Showing with 624 additions and 23,906 deletions.
  1. +575 −23,871 build/Three.js
  2. +31 −31 build/custom/ThreeWebGL.js
  3. +1 −1 examples/webgl_collisions_reaction.html
  4. +0 −2 examples/webgl_sprites.html
  5. +17 −1 src/renderers/WebGLRenderer.js
View
Oops, something went wrong.
Oops, something went wrong.
@@ -48,7 +48,7 @@
</script>
<script type="text/javascript">
- var scene, camera, renderer, info, mouse2d, sun, loader, sphere, debugNormal;
+ var camera, scene, renderer, info, mouse2d, sun, loader, sphere, debugNormal;
var range = 400;
var speed = 1;
@@ -46,7 +46,6 @@
scene = new THREE.Scene();
-
// create sprites
var amount = 200;
@@ -99,7 +98,6 @@
renderer = new THREE.WebGLRenderer();
renderer.setClearColorHex( 0x000000, 1 );
renderer.setSize( window.innerWidth, window.innerHeight );
- renderer.sortObjects = true;
container.appendChild( renderer.domElement );
@@ -4232,6 +4232,22 @@ THREE.WebGLRenderer = function ( parameters ) {
};
+ function removeInstancesDirect( objlist, object ) {
+
+ var o, ol;
+
+ for ( o = objlist.length - 1; o >= 0; o -- ) {
+
+ if ( objlist[ o ] == object ) {
+
+ objlist.splice( o, 1 );
+
+ }
+
+ }
+
+ };
+
function removeObject( object, scene ) {
// must check as shadow volume before mesh (as they are also meshes)
@@ -4249,7 +4265,7 @@ THREE.WebGLRenderer = function ( parameters ) {
} else if ( object instanceof THREE.Sprite ) {
- removeInstances( scene.__webglSprites, object );
+ removeInstancesDirect( scene.__webglSprites, object );
} else if ( object instanceof THREE.LensFlare ) {

0 comments on commit 78fb8ac

Please sign in to comment.