source file REDIShape.h

Go to the documentation of this file.

#ifndef RED_ISHAPE_H
#define RED_ISHAPE_H

#include "REDIObject.h"
#include "REDSTL.h"


//******************************************************************************
//*** RED::IShape update flags *************************************************
//******************************************************************************

#define RED_SHP_DAG_NO_UPDATE           (0x00000000)
#define RED_SHP_DAG_UPDATE              (0x00000001)
#define RED_SHP_DAG_PROPAGATE_DOWNWARD  (0x00000010)
#define RED_SHP_DAG_UPDATE_LEAVES       (0x00000020)
#define RED_SHP_DAG_PROPAGATE_UPWARD    (0x00000100)


//******************************************************************************
//*** RED::IShape interface ****************************************************
//******************************************************************************

namespace RED
{
  class BoundingSphere;
  class LayerSet;
  class State;
  
  
  // IShape types:
  // -------------
  
  typedef RED_RC (*USER_SWITCH_CALLBACK)( const RED::Object*  iViewpoint,
                                          const RED::Object*  iShape,
                                          RED::Vector<int>&   iSelectedChildren,
                                          void*               iUserData,
                                          int                 iStateNumber );
  
  
  // IShape interface:
  // -----------------
  
  class REDFullExp IShape : public IREDObject
  {
    public:
    
    // Typing information:
    // -------------------
    
    SET_CID( CID_class_REDIShape );
    
    
    // Bounding sphere operations:
    // ---------------------------
    
    virtual RED_RC GetBoundingSphere( RED::BoundingSphere*& oBoundingSphere,
                                      int                   iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetBoundingSphere( RED::BoundingSphere*& oBoundingSphere,
                                      const RED::State&     iState ) = 0;
    
    
    virtual RED_RC ComputeBoundingSphere( const RED::State& iState ) = 0;
    
    
    virtual RED_RC RemoveBoundingSphere( const RED::State& iState ) = 0;
    
    
    virtual RED_RC UpdateBoundingSpheres( int               iPropagationMode,
                                          const RED::State& iState ) = 0;
    
    
    // Child list operations:
    // ----------------------
    
    virtual RED_RC GetChildrenCount( int& oChildrenCount,
                                     int  iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetChildren( const RED::Vector< RED::Object* >*& oChildList,
                                int                                 iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetChild( RED::Object*&  oChild,
                             int            iChildNumber, 
                             int            iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetChildByID( RED::Object*&  oChild,
                                 unsigned int   iChildID, 
                                 int            iStateNumber = -1 ) const = 0;
    

    virtual RED_RC GetChildByID( RED::Object*&      oChild,
                                 const RED::String& iChildID,
                                 int                iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC IsChildOf( bool&               ioChildOf,
                              const RED::Object*  iShape,
                              int                 iStateNumber = -1 ) const = 0;
    

    virtual RED_RC GetShapes( RED::Map< RED::Object*, unsigned int >& oShapes, 
                              const RED::CID&                         iCID ) = 0;


    // Parent list operations:
    // -----------------------
    
    virtual RED_RC GetParentsCount( int& oParentsCount,
                                    int  iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetParents( const RED::Vector< RED::Object* >*&  oParentlist,
                               int                                  iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetParent( RED::Object*& oParent,
                              int           iParentNumber, 
                              int           iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC GetParentViewpoints( RED::Vector< RED::Object* >& oViewpointList,
                                        int                          iStateNumber = -1 ) const = 0;
    
    
    // Material operations:
    // --------------------
    
    virtual RED_RC GetMaterial( RED::Object*& oMaterial,
                                int           iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC SetMaterial( RED::Object*      iMaterial,
                                const RED::State& iState ) = 0;
    
    
    virtual RED_RC RemoveMaterial( const RED::State& iState ) = 0;
    
    
    // Layer operations:
    // -----------------
    
    virtual RED_RC AddToLayer( unsigned int       iLayer,
                               const RED::State&  iState ) = 0;
    
    
    virtual RED_RC RemoveFromLayer( unsigned int      iLayer,
                                    const RED::State& iState ) = 0;
    
    
    virtual RED_RC GetLayerSet( const RED::LayerSet*& iLayerSet, 
                                int                   iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC ApplyLayerSet( const RED::LayerSet* iLayerSet,
                                  const RED::State&    iState ) = 0;
    
    
    virtual RED_RC RemoveLayerSet( const RED::State& iState ) = 0;
    
    
    virtual RED_RC RemoveChildrenLayerSets( const RED::State& iState ) = 0;
    
    
    // Culling management:
    // -------------------
    
    virtual RED_RC SetContextSwitchCallback( USER_SWITCH_CALLBACK iContextSwitchCB,
                                             void*                iUserData,
                                             const RED::State&    iState ) = 0;
    
    
    virtual RED_RC GetContextSwitchCallback( USER_SWITCH_CALLBACK& oContextSwitchCB,
                                             void*&                oUserData,
                                             int                   iStateNumber = -1 ) const = 0;
    
    
    virtual RED_RC SetVisibilitySwitchCallback( USER_SWITCH_CALLBACK iVisibilitySwitchCB,
                                                void*                iUserData,
                                                const RED::State&    iState ) = 0;
    
    
    virtual RED_RC GetVisibilitySwitchCallback( USER_SWITCH_CALLBACK& oVisibilitySwitchCB,
                                                void*&                oUserData,
                                                int                   iStateNumber = -1 ) const = 0;
    
    
    // Miscellaneous methods:
    // ----------------------
    
    virtual RED_RC RemoveFromGPU( const RED::State& iState ) = 0;
    
    
    virtual RED_RC GetMemorySize( RED::uint64& oByteSize ) const = 0;
    
    
    virtual RED_RC ForceUpdate( const RED::State& iState ) = 0;
    
    
    virtual bool IsInDestroy() const = 0;
  };
};


#endif