nodedisp.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *<
00003     FILE: nodeDisp.h
00004 
00005     DESCRIPTION: Interface for node display callbacks
00006 
00007     CREATED BY: Cleve Ard
00008 
00009     HISTORY: Created April 3, 2000
00010 
00011  *> Copyright (c) 2000, All Rights Reserved.
00012  **********************************************************************/
00013 #pragma once
00014 
00015 #include "baseinterface.h"
00016 #include "strclass.h"
00017 
00018 // forward declarations
00019 class ViewExp;
00020 class INode;
00021 class Object;
00022 class Box3;
00023 class IPoint2;
00024 
00025 // A callback to allow plug-ins that aren't actually objects (such as utilities)
00026 // to control a Node's display
00037 class NodeDisplayCallback : public InterfaceServer {
00038     public:
00039 
00040         // StartDisplay is called right before the tree of nodes is drawn
00050       virtual void StartDisplay(TimeValue t, ViewExp *vpt, int flags)=0;
00051         // EndDisplay is called right after the tree of nodes is drawn
00061        virtual void EndDisplay(TimeValue t, ViewExp *vpt, int flags)=0;
00062         // Display: Called for every node
00083         virtual bool Display(TimeValue t, ViewExp *vpt, int flags, INode *node,Object *pObj)=0;     
00084         // HideObject: Queries if the normal node mesh should be displayed
00092         virtual bool SuspendObjectDisplay(TimeValue t,INode *node)=0;
00093         // AddNodeCallbackBox: Asks the callback to participate in the bounding box calculation
00106         virtual void AddNodeCallbackBox(TimeValue t, INode *node, ViewExp *vpt, Box3& box,Object *pObj)=0;
00107         // HitTest: Hit testing on the callback's mesh
00126         virtual bool HitTest(TimeValue t, INode *node, int type, int crossing, int flags, IPoint2 *p, ViewExp* vpt,Object *pObj)=0;
00127         // Activate: Called when the callback gets activated, it's up to the callback to invalidate the screen
00130         virtual void Activate()=0;
00131         // Deactivate: Called when the callback is deactivated
00134         virtual void Deactivate()=0;
00135         // GetName: Queries the name of the callback. (Used for display in the menu)
00139         virtual MSTR GetName() const = 0;// user must delete the string
00140 
00141     };
00142 
00143 #define IID_NODE_DISPLAY_CALLBACK_EX Interface_ID(0x5c583214, 0x4a3b44e7)
00144 
00145 //we're adding an overload of SuspendObjectDisplay which gets a viewport and the object cache
00146 class NodeDisplayCallbackEx : public BaseInterface, public NodeDisplayCallback{
00147     public:
00148 
00149         // HideObject: Queries if the normal node mesh should be displayed
00150         virtual bool SuspendObjectDisplay(TimeValue t, ViewExp *vpt,  INode *node,Object *pObj )=0;
00151     };
00152 
00153 #define I_NODEDISPLAYCONTROL  0x00001000    
00154 
00155 // Gets a pointer to the INodeDisplayControl interface, the caller should pass a pointer to "Interface"
00156 #define GetNodeDisplayControl(i)  ((INodeDisplayControl*)i->GetInterface(I_NODEDISPLAYCONTROL))
00157 
00158 // An interface that is used to register the node display callback.
00167 class INodeDisplayControl : public InterfaceServer
00168 {
00169     public:
00170 
00171         // Register a NodeDisplayCallback
00177         virtual void RegisterNodeDisplayCallback(NodeDisplayCallback *cb)=0;
00182         virtual void UnRegisterNodeDisplayCallback(NodeDisplayCallback *cb)=0;
00183 
00184         //Set and get the current current callback, the callback must be registered
00191         virtual bool SetNodeCallback(NodeDisplayCallback* hook)=0;
00194         virtual NodeDisplayCallback* GetNodeCallback()=0;
00195 
00196 
00197         // Viewport refresh routine
00198         // this function only invalidates the display, it's up to the callback to select the correct redraw technique.
00202         virtual void InvalidateNodeDisplay()=0;
00203 
00204 };
00205