Closed jeromeetienne closed 12 years ago
Would be a good example
Three.object3d.plugins = Pluginsjsfunction'
Here you get the list of all the object which ok to modify
Start with static helpers as theyr are pretty safe
File naming convention
// filename: three.geometry.tools.js
THREE.Geometry.register('center', {
})
geometry.center().width().height().depth();
geometry.flip();
geometry.scale().translate().rotate();
(function(){
this.register = function(object, methodName, metadata) {
if( object[methodName] ){
throw new Error('Conflict! Already method called: ' + methodName);
}
object[methodName] = metadata[methodName];
};
this.unregister = function(object, methodName) {
if( object.hasOwnProperty(methodName) === false ){
throw new Error('Plugin not found: ' + methodName);
}
delete object[methodName];
};
this.registered = function(object, methodName){
return object.hasOwnProperty(methodName) === true;
}
return this;
})(THREE.Geometry.prototype);
Did some code in examples