Skip to content

Instantly share code, notes, and snippets.

@skrat
Created December 18, 2011 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skrat/1493467 to your computer and use it in GitHub Desktop.
Save skrat/1493467 to your computer and use it in GitHub Desktop.
diff --git a/src/extras/loaders/ColladaLoader.js b/src/extras/loaders/ColladaLoader.js
index 18b1d98..a30aba7 100644
--- a/src/extras/loaders/ColladaLoader.js
+++ b/src/extras/loaders/ColladaLoader.js
@@ -1846,6 +1846,9 @@ THREE.ColladaLoader = function () {
for ( i = 0; i < this.primitives.length; i ++ ) {
var primitive = this.primitives[ i ];
+ if (primitive.count == 0) {
+ continue;
+ }
primitive.setVertices( this.vertices );
this.handlePrimitive( primitive, this.geometry3js, vertex_store );
diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js
index 0aee9d4..ba4af63 100644
--- a/src/renderers/WebGLRenderer.js
+++ b/src/renderers/WebGLRenderer.js
@@ -3863,6 +3863,9 @@ THREE.WebGLRenderer = function ( parameters ) {
for ( g in geometry.geometryGroups ) {
geometryGroup = geometry.geometryGroups[ g ];
+ if (!geometryGroup.materialIndex) {
+ continue;
+ }
// initialise VBO on the first access
@@ -4007,6 +4010,9 @@ THREE.WebGLRenderer = function ( parameters ) {
geometryGroup = geometry.geometryGroupsList[ i ];
material = getBufferMaterial( object, geometryGroup );
+ if (!material) {
+ continue;
+ }
customAttributesDirty = material.attributes && areCustomAttributesDirty( m
@@ -4028,6 +4034,9 @@ THREE.WebGLRenderer = function ( parameters ) {
geometry.__dirtyColors = false;
geometry.__dirtyTangents = false;
+ if (!material) {
+ return;
+ }
material.attributes && clearCustomAttributes( material );
} else if ( object instanceof THREE.Ribbon ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment