Hello Friends,
Normally I am using these codes ,
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({color: 0x44aa88});
const mesh = new THREE.Mesh(geometry, material);
However,I saw the following type of code somewhere and I am confused.
How does the following code work ?
Because Function CreateMaterial() has no return type but we are calling CreateMaterial() function inside THREE.Mesh
What is the logic of using code like that
function CreateMaterial(){
const material = new THREE.MeshBasicMaterial({color: 0x44aa88});
}
const geometry = new THREE.BoxGeometry(1, 1, 1);
const mesh = new THREE.Mesh(geometry,CreateMaterial());