Reputation: 341
I am new to Threejs.
I am trying to understand the JSON structure for JSON Object Scene format 4.
"object": {
"uuid": "89529CC6-CBAC-412F-AFD1-FEEAE785BA19",
"type": "Scene",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [
{
"uuid": "33FA38D9-0AAC-4657-9BBE-5E5780DDFB2F",
"name": "Box 1",
"type": "Mesh",
"geometry": "C3BF1E70-0BE7-4E6D-B184-C9F1E84A3423",
"material": "87D95D6C-6BB4-4B8F-8166-A3A6945BA5E3",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
},
{
"uuid": "16F2E381-2B73-44C4-A7BB-38D7E1CD2381",
"name": "PointLight 1",
"type": "PointLight",
"color": 16777215,
"intensity": 1,
"distance": 0,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,100,200,150,1]
}
]
}
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,100,200,150,1]
Does this matrix depicts this: "matrix": [xx,xy,xz,?,yx,yy,yz,?,zx,zy,zz,?,px,py,pz,?]
What are the "?" in this matrix?
Upvotes: 2
Views: 299
Reputation: 31026
The matrix property in the JSON refers to the Object3D.matrix
property which is in fact a 4x4 matrix.
The Matrix4
class in three.js
stores its numbers in the elements
property. It is an array which holds the numbers in column-major order. When a matrix is serialized/deserialized, this order is maintained.
So what you see in the JSON is a serialized 4x4 matrix in column-major order.
Upvotes: 2