{"action":"created","issue":{"url":"https://api.github.com/repos/threeDart/three.dart/issues/96","labels_url":"https://api.github.com/repos/threeDart/three.dart/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/threeDart/three.dart/issues/96/comments","events_url":"https://api.github.com/repos/threeDart/three.dart/issues/96/events","html_url":"https://github.com/threeDart/three.dart/issues/96","id":16982018,"number":96,"title":"Vertex / Face colors","user":{"login":"markhats","id":3472245,"avatar_url":"https://avatars.githubusercontent.com/u/3472245?v=3","gravatar_id":"","url":"https://api.github.com/users/markhats","html_url":"https://github.com/markhats","followers_url":"https://api.github.com/users/markhats/followers","following_url":"https://api.github.com/users/markhats/following{/other_user}","gists_url":"https://api.github.com/users/markhats/gists{/gist_id}","starred_url":"https://api.github.com/users/markhats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markhats/subscriptions","organizations_url":"https://api.github.com/users/markhats/orgs","repos_url":"https://api.github.com/users/markhats/repos","events_url":"https://api.github.com/users/markhats/events{/privacy}","received_events_url":"https://api.github.com/users/markhats/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2013-07-19T17:19:17Z","updated_at":"2015-02-12T16:45:35Z","closed_at":null,"body":"Just wondered if anyone had got vertex or face colors to work? Variations of the following code always seem to give me a white sphere:\r\n\r\n```dart\r\nThree.SphereGeometry spheregeometry = new Three.SphereGeometry(5.0, 10, 10);\r\n      \r\nspheregeometry.colors = new List<Three.Color>(spheregeometry.vertices.length);\r\n      \r\n// First, assign colors to vertices as desired\r\nfor (int i = 0; i < spheregeometry.vertices.length; i++) \r\n{\r\n   spheregeometry.colors[i] = new Three.Color().setRGB(77, 115, 153);\r\n}\r\n      \r\nfor (int i = 0; i < spheregeometry.faces.length; i++) \r\n{\r\n   var face = spheregeometry.faces[i];\r\n         \r\n   // face.color.setRGB(77, 115, 153);\r\n        \r\n   // Determine if face is a tri or a quad\r\n   int numberofsides = (face is Three.Face3) ? 3 : 4;\r\n         \r\n   face.vertexColors = new List<Three.Color>(numberofsides);\r\n         \r\n   // Assign color to each vertex of current face\r\n   for (int j = 0; j < numberofsides; j++)  \r\n   {\r\n      var vertexindex = face.indices[j];\r\n            \r\n      // Initialize color variable\r\n      face.vertexColors[j] = spheregeometry.colors[vertexindex]; \r\n   }\r\n}            \r\n      \r\nThree.Material material = new Three.MeshBasicMaterial( \r\n      color: 0xffffff, shading: Three.FlatShading, \r\n      vertexColors: Three.VertexColors);\r\n      \r\nThree.Mesh spheremesh = new Three.Mesh(spheregeometry, material);\r\n      \r\nscene.add(spheremesh);\r\n```\r\nAnything obvious I'm doing wrong?"},"comment":{"url":"https://api.github.com/repos/threeDart/three.dart/issues/comments/74105188","html_url":"https://github.com/threeDart/three.dart/issues/96#issuecomment-74105188","issue_url":"https://api.github.com/repos/threeDart/three.dart/issues/96","id":74105188,"user":{"login":"markhats","id":3472245,"avatar_url":"https://avatars.githubusercontent.com/u/3472245?v=3","gravatar_id":"","url":"https://api.github.com/users/markhats","html_url":"https://github.com/markhats","followers_url":"https://api.github.com/users/markhats/followers","following_url":"https://api.github.com/users/markhats/following{/other_user}","gists_url":"https://api.github.com/users/markhats/gists{/gist_id}","starred_url":"https://api.github.com/users/markhats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markhats/subscriptions","organizations_url":"https://api.github.com/users/markhats/orgs","repos_url":"https://api.github.com/users/markhats/repos","events_url":"https://api.github.com/users/markhats/events{/privacy}","received_events_url":"https://api.github.com/users/markhats/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T16:45:35Z","updated_at":"2015-02-12T16:45:35Z","body":"spheregeometry.vertices.length is the total number of vertices that make up all the faces. Each face has 3 (tri) or 4 (quad) vertices."}}