now my task is to load a 3d model from a MySQL database and use it in Three.js.
Here is what I have done,
i created a database like this
models{model_id int(4), model mediumblob};
I can successfully load the 3d models in JSON format to and from the database.
I know how to retrive the data from DB.
But my problem is - 'How do i make the JSON file that is loaded from DB to be used by Three.js?'
I load the Json file conventionally like this
// instantiate a loader
var loader = new THREE.JSONLoader();
// load a resource
loader.load(
// resource URL
'models/animated/monster/monster.js',
// Function when resource is loaded
function ( geometry, materials ) {
var material = new THREE.MultiMaterial( materials );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
}
);
This is an example code from Three.js documentation.
The resource URL appears to be a file located physically in the root. But I can't figure it out in my head 'how to load the model obtained from Database to Three.js?'
I am not asking for any code.
Just guide me to load the file in Three.js
I am familiar with loading an simple image. But that is html oriented. This is Three.js oriented.