Unlike and .obj
file which probably contained information about the materials and geometries, the CTM
file only contains information about the geometries.
So if you look at the code of the ThreeJs Editor here you will find that it loads the geometries
from the CTM
file and manually creates a MeshPhongMaterial
and then creates a mesh using these two and adds it to the editor.scene
.
So the complete code will be something like this would be
var loaderCTM = new THREE.CTMLoader( true );
loaderCTM.load( "models/camaro/camaro.ctm", function( geometry ) {
var material = new THREE.MeshPhongMaterial();
var mesh = new THREE.Mesh( geometry, material );
mesh.name = "camero";
editor.addObject( mesh );
editor.select( mesh );
}, false );
I have also created a sample here , you can look around at lines 124 to understand better.