7.9. SoAppearanceKit

SoAppearanceKit( C++ | Java | .NET ) is a subclass of SoBaseKit( C++ | Java | .NET ), provided as part of the standard Inventor library. It is a collection of all property nodes that affect the appearance of a rendered shape. Eight parts are added as direct children of the node kit. A diagram of the catalog's structure is shown in Figure 7.5, “ Catalog Diagram for SoAppearanceKit ”.

Catalog Diagram for SoAppearanceKit

Figure 7.5.  Catalog Diagram for SoAppearanceKit


Examples 7-1 and 7-2 show the complete header and source files for the SoAppearanceKit( C++ | Java | .NET ) class. For brevity's sake, comments are omitted.

Example 7.1.  SoAppearanceKit.h


C++
#include <Inventor/nodekits/SoBaseKit.h>

class SoAppearanceKit : public SoBaseKit {

   SO_KIT_HEADER(SoAppearanceKit);

   // Defines fields for the new parts in the catalog
   SO_KIT_CATALOG_ENTRY_HEADER(lightModel);
   SO_KIT_CATALOG_ENTRY_HEADER(environment);
   SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
   SO_KIT_CATALOG_ENTRY_HEADER(material);
   SO_KIT_CATALOG_ENTRY_HEADER(complexity);
   SO_KIT_CATALOG_ENTRY_HEADER(texture2);
   SO_KIT_CATALOG_ENTRY_HEADER(font);

  public:
   // Constructor
   SoAppearanceKit();

  SoINTERNAL public:
   static void initClass();
   static void exitClass();

  private:

   // Destructor
   virtual ~SoAppearanceKit();
};

Example 7.2.  SoAppearanceKit.c++


C++
#include <Inventor/SoDB.h>
#include <Inventor/nodekits/SoAppearanceKit.h>
#include <Inventor/nodes/SoLightModel.h>
#include <Inventor/nodes/SoEnvironment.h>
#include <Inventor/nodes/SoDrawStyle.h>
#include <Inventor/nodes/SoMaterial.h>
#include <Inventor/nodes/SoComplexity.h>
#include <Inventor/nodes/SoTexture2.h>
#include <Inventor/nodes/SoFont.h>

SO_KIT_SOURCE(SoAppearanceKit);

void
SoAppearanceKit::initClass()
{
   SO_KIT_INIT_CLASS(SoAppearanceKit, SoBaseKit, "BaseKit");
}

void
SoAppearanceKit::exitClass()
{
   SO__KIT_EXIT_CLASS(SoAppearanceKit);
}

//    Constructor
SoAppearanceKit::SoAppearanceKit()
{
   SO_KIT_CONSTRUCTOR(SoAppearanceKit);

   isBuiltIn = TRUE;

   // Initialize children catalog and add entries to it
   // These are the macros you use to make a catalog.
   // Use combinations of ...ADD_CATALOG_ENTRY 
   // and ...ADD_CATALOG_LIST_ENTRY.  See SoSubKit.h for more
   // info on syntax of these macros.
   SO_KIT_ADD_CATALOG_ENTRY(lightModel,  SoLightModel, TRUE,
                            this, "", TRUE );
   SO_KIT_ADD_CATALOG_ENTRY(environment, SoEnvironment,TRUE,
                            this, "", TRUE );
   SO_KIT_ADD_CATALOG_ENTRY(drawStyle,   SoDrawStyle,  TRUE,
                            this, "", TRUE );
   SO_KIT_ADD_CATALOG_ENTRY(material,    SoMaterial,   TRUE,
                            this, "", TRUE );
   SO_KIT_ADD_CATALOG_ENTRY(complexity,  SoComplexity, TRUE,
                            this, "", TRUE );
   SO_KIT_ADD_CATALOG_ENTRY(texture2,    SoTexture2,   TRUE,
                            this, "", TRUE );

   SO_KIT_ADD_CATALOG_ENTRY(font, SoFont, TRUE, this, ,TRUE );

   SO_KIT_INIT_INSTANCE();
}

// Destructor (necessary since inline destructor is too
// complex)

// Use: public

SoAppearanceKit::~SoAppearanceKit()
{
}