Skip to content

Commit

Permalink
Use default when loading model that does not specify some textures
Browse files Browse the repository at this point in the history
This fixes #86.
  • Loading branch information
cochrane committed Mar 19, 2018
1 parent 5130206 commit f878ae5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion GLLara/GLLItemMesh.m
Expand Up @@ -212,7 +212,13 @@ - (void)_createTextureAndShaderAssignments;
GLLItemMeshTexture *texture = [NSEntityDescription insertNewObjectForEntityForName:@"GLLItemMeshTexture" inManagedObjectContext:self.managedObjectContext];
texture.mesh = self;
texture.identifier = self.mesh.shader.textureUniformNames[i];
texture.textureURL = self.mesh.textures[i];
if (i >= self.mesh.textures.count) {
// Grrr, idiot forgot to set texture that the shader is clearly
// using. Need to use some default.
texture.textureURL = [self.mesh.model.parameters defaultValueForTexture:texture.identifier];
} else {
texture.textureURL = self.mesh.textures[i];
}
}

// Find shader value
Expand Down

0 comments on commit f878ae5

Please sign in to comment.