I have created a Json Buffer geometry as follows:
var myJson = {
"metadata": {
"version": 3,
"type": "Geometry",
"position": 8,
"generator": "io_three"
},
"data": {
"index": {
"array": [0, 1, 2, 0, 2, 3, 1, 2, 5, 2, 5, 6, 3, 2, 6, 3, 6, 7, 0, 3, 4, 3, 4, 7, 0, 1, 5, 0, 4, 5, 4, 5, 6, 4, 6, 7],
"type": "Uint16Array",
"itemSize": 1
},
"attributes": {
"position": {
"array": [0, 0, 0, 1, 0, 0, 1, 0, 3, 0, 0, 3, 0, -10, 0, 1, -10, 0, 1, -10, 3, 0, -10, 3],
"type": "Float32Array",
"itemSize": 3
}
},
}
};
To load and add a texture to the geometry I used the following:
var loader = new THREE.BufferGeometryLoader();
var mygeometry = loader.parse(myJson);
mygeometry.computeVertexNormals(true);
var cubeMaterial = new THREE.MeshLambertMaterial({ color: 0xffffff, side: THREE.DoubleSide });
cubeMaterial.map = new THREE.TextureLoader().load("img/lava.png")
It does not show any texture. However if I replace the above Geometry with a basic cube geometry as follows, It works perfectly:
var cubeGeometry = new THREE.BoxBufferGeometry(2, 2, 2);
Am I missing something in my Json Geometry?