mrdoob/three.js — Issue #1096: setting color in json file
Author: cutama
Created: 2012-01-13 00:48:51+00:00
State: open

I'm experimenting with the JSON loader, and trying to understand the format.

I want to display a quad with some color with it but could not get the color to show.
The geometry shows white color. I am using the MeshBasicMaterial in the callback function like so:

jsonLoader.load( "test.js", function( geometry ) {
var mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial() );
mesh.doubleSided = true;
scene.add( mesh );
}
);

What should I do to show the color correctly?

Here is the JSON file:

{

"metadata" :
{
"formatVersion" : 3
},

"scale" : 1.000000,

"materials": [],

"vertices": [0,0,0, 100,0,0, 100,0,200, 0,0,200],

"morphTargets": [],

"morphColors": [],

"normals": [],

"colors": [16711680], // 0xFF0000

"uvs": [],

"faces": [193, 0,1,2,3, 0, 0,0,0,0]

}

Thanks,
Christian