AddRenderables to WireFrameSet

I've been looking at adding wireframes and manipulators to some of my plugins. I'd put off trying this in the past because the out of date and overly complex example in the SDK (NonUniformScale) made something that is really quite simple totally confusing. As I figured out how to use the TBasicWireframeSet I noticed that I3DShWireFrameSet has the ::AddRenderables(TMCPtrArray &renderables;). This would be very useful as I3DShRenderable says that it can also include a FacetMesh to be rendered by the interactive renderer. This appears to include its own TShadingApproximation which could be great for replacing the zones my plugins use where the only solution in the past has been to get the user to set that up with a sphere primitive themselves - as well as suggesting a way to possibly implement weight painting like features with the TPointMesh that allow for individual RGB vertex colours.

Based on experience and other code I've seen I made an educated guess as to how to go about adding a renderable but nothing showed up. Rather than wasting precious time I would like to know :

1. Is I3DShWireFrameSet::AddRenderables() actually implemented ?
2. If so what is the right place to add the renderables to the wireframe - is it in myPlugin::DataToWireframe(...) ?
3. What is the lifetime of the I3DShRenderable array ? Can it be created in ::DataToWireframe(...) with TMCCountedPtr(s) and then let go ?
4. Do I make my renderable based on TCountedRenderable or TSimpleShapeRenderable to have a FacetMesh ?

Obviously some example code and the right calls would be great. I can post the code I tried if anyone thinks they can spot a mistake.

Comments

  • dtammdtamm Posts: 126
    edited December 1969

    I've been looking at adding wireframes and manipulators to some of my plugins. I'd put off trying this in the past because the out of date and overly complex example in the SDK (NonUniformScale) made something that is really quite simple totally confusing. As I figured out how to use the TBasicWireframeSet I noticed that I3DShWireFrameSet has the ::AddRenderables(TMCPtrArray &renderables;). This would be very useful as I3DShRenderable says that it can also include a FacetMesh to be rendered by the interactive renderer. This appears to include its own TShadingApproximation which could be great for replacing the zones my plugins use where the only solution in the past has been to get the user to set that up with a sphere primitive themselves - as well as suggesting a way to possibly implement weight painting like features with the TPointMesh that allow for individual RGB vertex colours.

    Based on experience and other code I've seen I made an educated guess as to how to go about adding a renderable but nothing showed up. Rather than wasting precious time I would like to know :

    1. Is I3DShWireFrameSet::AddRenderables() actually implemented ?
    2. If so what is the right place to add the renderables to the wireframe - is it in myPlugin::DataToWireframe(...) ?
    3. What is the lifetime of the I3DShRenderable array ? Can it be created in ::DataToWireframe(...) with TMCCountedPtr(s) and then let go ?
    4. Do I make my renderable based on TCountedRenderable or TSimpleShapeRenderable to have a FacetMesh ?

    Obviously some example code and the right calls would be great. I can post the code I tried if anyone thinks they can spot a mistake.

    1) There is a default implementation of I3DShWireFrameSet that implements AddRenderables. This function grabs all the renderables inside the I3DShWireFrameSet and adds them to the array passed in. Or in other words, the variable "TMCPtrArray& renderables" is an out variable.

    Let me see about putting together a sample.

  • Sparrowhawke3DSparrowhawke3D Posts: 98
    edited December 1969

    Thanks for you help and advice dtamm,

    I think I understand it better now. When I use TBasicWireframeSet then the I3DExWireFrameSet::DataToWireFrame(...) is passed the I3DShWireFrameSet. To that I can .AllocateLists(points,connection) to build up the TWFPointList and TWFConnectionList. The SDK reference states that although the EWFListType has a flag for kWFFacetList that is it not implemented. I saw the renderables and thought that it might be a way to add facets with shading. So Carrara calls my modifier's DataToWireFrame and gives it a wire frame object to build the lists of handles and lines then it calls ::AddRenderables() internally when it is ready to draw the wire frame all managed by a I3DExRendererBox to draw everything in a 3D preview.

    That appears to be a dead end then and I need to stick to using wire frames as wire frames only.

Sign In or Register to comment.