Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
PyramidKit

The next two examples show PyramidKit, a new subclass of SoShapeKit that uses the Pyramid node created in Creating a Node. By making it a subclass of SoShapeKit, this new kit inherits all the parts, such as “appearance,” “transform,” and “units,” used by all the other shape kits. This class changes the type and defaultType of one of the parts in the parent class, SoShapeKit.

PyramidKit.h shows the header file for PyramidKit. PyramidKit.c++ shows the source code for this new node-kit class.

Example : PyramidKit.h

#include <Inventor/nodekits/SoShapeKit.h>
class PyramidKit : public SoShapeKit
{
SO_KIT_HEADER( PyramidKit );
public:
PyramidKit();
static void initClass();
static void exitClass();
private:
virtual ~PyramidKit();
};

Example : PyramidKit.c++

#include <Inventor/SoDB.h>
// Include files for new classes
#include "Pyramid.h"
#include "PyramidKit.h"
SO_KIT_SOURCE( PyramidKit );
void
PyramidKit::initClass()
{
SO_KIT_INIT_CLASS( PyramidKit, SoShapeKit, "ShapeKit" );
}
void
PyramidKit::exitClass()
{
SO__KIT_EXIT_CLASS( PyramidKit );
}
PyramidKit::PyramidKit()
{
SO_KIT_CONSTRUCTOR( PyramidKit );
// Change the 'shape' part to be a Pyramid node.
SO_KIT_CHANGE_ENTRY_TYPE( shape, Pyramid, Pyramid );
SO_KIT_INIT_INSTANCE();
}
PyramidKit::~PyramidKit() {}