From: Roger H. <rog...@mi...> - 2005-08-22 18:27:31
|
With QuickDraw3D, Apple were gradually opening up the extensibility. First we had custom attributes, then custom renderers, then custom groups. Then they dropped the technology and we started work on Quesa. I have been thinking about custom geometries. I had a look at the code of one of the geometries which Apple themselves added, the Torus. Its meta-handler just overrides six methods, kQ3XMethodTypeObjectNew, kQ3XMethodTypeObjectDelete, kQ3XMethodTypeObjectDuplicate, kQ3XMethodTypeGeomCacheNew, kQ3XMethodTypeGeomGetAttribute and kQ3XMethodTypeGeomUsesSubdivision. It is possible to register a custom class which inherits from geometry, and to override the first three of the methods. The next three are private to Quesa, or at least they are in E3Globals.h, which is not supposed to be a public API. The 'get geometry attribute' method seems a fairly straightforward thing to do. In fact I'm surprised it is not built into the geometry class itself, but there may be some gotcha that makes this difficult. Anyway I don't see too much of a problem if we were to make the constant public by moving it to Quesa.h. 'uses subdivision' is not even a real method, it merely returns true or false. Again I personally don't see this as much of an issue. The kQ3XMethodTypeGeomCacheNew method is actually what gets called when we call Q3Geometry_GetDecomposed, so in retrospect the name could maybe have been kQ3XMethodTypeGeomDecompose. To me this seems a rather better name to make public. Another alternative I guess would be to open up the submit methods for render, write, pick and calculate bounds modes. This would of course be a bit more complicated. Your thoughts please on : The whole concept of custom geometries, are we ready for them, the pros and cons. The way (if found beneficial) of opening up the API to make this possible. Roger Holmes. |