On 09/06/2014 at 13:51, xxxxxxxx wrote:
I'm not really sure about the vertex colors thing.
When I create my text HUD images. I do get each corner of the plane object that the image will stick onto and color them. But that's only four verts. Not a lot of them.
When I started out using Draw(). One of the things I did wrong was to instantiate things in there instead of in the Init() method. And that tended to make the Draw() run slow.
Example:
//You should allocate draw objects at the Init() of the plugin and free at Free() of the plugin
class MyObject : public ObjectData
{
public:
virtual Bool Init(GeListNode *node);
virtual void Free(GeListNode* node);
virtual Bool Message(GeListNode *node, LONG type, void *data);
virtual DRAWRESULT Draw (BaseObject *op, DRAWPASS type, BaseDraw *bd, BaseDrawHelp *bh);
virtual Bool AddToExecution(BaseObject *op, PriorityList *list); //Lets you define your own execution pointer
virtual EXECUTIONRESULT Execute(BaseObject *op, BaseDocument *doc, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags);
static NodeData *Alloc(void) { return gNew MyObject; }
private:
PolygonObject* sphere;
};
Bool MyObject::Init(GeListNode *node)
{
//Create a polygon sphere by creating a primitive sphere first..then casting it to a polygon object type
sphere = (PolygonObject* )GeneratePrimitive(node->GetDocument(), Osphere, BaseContainer(), 1.0, FALSE, NULL);
BaseObject *op = (BaseObject* )node;
BaseContainer *bc = op->GetDataInstance();
bc->SetReal(MYOBJECT_RADIUS,1.0);
return TRUE;
}
void MyObject::Free(GeListNode* node)
{
PolygonObject::Free(sphere);
}
I've never tried to color each polygon face a different color. Let alone a lot of them.
Normally I am either coloring the whole object a different color...Or coloring (highlighting) the selected polygons. So I don't know if that presents a problem in the Draw() method or not.
But it just seems wrong to me to have to use a SH just to draw polygons like that. But I'm not an expert on this stuff and I could be (and I often am
) wrong.
-ScottA