Not sure if this has been covered, but I came to the realisation that replacing the Load* functions is quite simple with low overhead...
example (in coffeescript)
class Color
constructor: (r, g, b, a=255) ->
color = CreateColor r, g, b, a
color.constructor = c
return color
white = new Color 255, 255, 255
In JS you can return another object from a constructor, so all we have to do is fix the constructor of Sphere's object. The fixed object is still accepted by the API, and instanceof works.
in JS
function Color(r, g, b, a) {
var color;
if (a == null) {
a = 255;
}
color = CreateColor(r, g, b, a);
color.constructor = Color;
return color;
}