The Inventor Toolmaker describes how to create new classes and how to customize existing classes in the Open Inventor Toolkit, an object-oriented toolkit used for interactive 3D graphics. This book is a companion to The Inventor Mentor, which describes how to write applications using the Open Inventor Toolkit.
There are several ways to extend the Inventor toolkit. The quickest way, and the only way available without using C++, is to use callback functions. Various classes, such as the SoCallback and SoEventCallback nodes and the SoCallbackAction, support callbacks to add user-defined behavior. To truly extend the system, however, requires C++ subclassing, which is the subject of this book.
Many Inventor classes and member functions are labeled as SoEXTENDER, which means they are available to programmers who wish to extend the toolkit. Note that these classes and functions are not documented in the Open Inventor C++ Reference Manual. Refer to header files and this book for information on them.
Other classes and methods are labeled as SoINTERNAL. These are used solely within the Open Inventor library and should not be used in applications. The labels SoEXTENDER and SoINTERNAL are for documentation purposes only and are not checked by the compiler.
This book is for the advanced programmer and describes how to create new Inventor classes and how to customize existing classes in the Open Inventor Toolkit.
The Inventor Toolmaker contains the following parts and chapters:
Part I, “Extending Database Classes,” has seven chapters:
Chapter 1, “Key Concepts,” describes important background information on the Open Inventor Toolkit that was not needed in The Inventor Mentor. It introduces concepts such as the method list, state and elements, the stack index, caching, runtime typing, and using extender macros. If you are creating any database class (described in Chapters 2 through 6), it is required reading.
Chapter 2, “Creating a Node,” describes how to create new subclasses of SoNode. Examples show creating a new property node class, shape node class, and group node class.
Chapter 3, “Creating a Field,” describes how to create new subclasses of SoField, including single-value and multiple-value fields.
Chapter 4, “Creating an Action,” describes how to create new subclasses of SoAction.
Chapter 5, “Creating an Element,” describes how to create new subclasses of SoElement.
Chapter 6, “Creating an Engine,” describes how to create new subclasses of SoEngine, including new field converters. It also explains how notification of changes in field data propagates through the scene graph.
Chapter 7, “Creating a Node Kit,” describes how to create new subclasses of SoBaseKit.
Part II, “Extending Interaction Classes,” has four chapters:
Chapter 8, “Creating Draggers and Manipulators,” describes how to create new subclasses of SoDragger as well as new manipulators, which are derived from other node classes such as SoTransform, SoLight, or SoCamera. If you are creating a new dragger, you'll need to read Chapter 7 as well, because draggers are node kits.
Chapter 9, “Creating a Selection Highlight Style,” describes how to create new subclasses of SoGLRenderAction to perform selection highlighting. If you're creating a new highlight class, you'll need to read Chapter 4, because highlight classes are derived from an action class, SoGLRenderAction.
Chapter 10, “Creating a Component,” describes how to create new components. Examples show creating a simple component derived from SoXtRenderArea as well as a simple viewer.
Chapter 11, “Creating an Event and Device,” describes how to create a new event and a new Xt device. The chapter also describes how to translate X events into Inventor events.
This book assumes you are familiar with the material presented in The Inventor Mentor. In addition, you need to be familiar with the C++ programming language as well as concepts related to object-oriented programming. See “Suggestions for Further Reading” for good background information.
This book uses boldface text font for all Inventor classes, methods, and field names: SoNode, SoMaterial, getValue(), setValue(), ambientColor, and center. Parentheses indicate methods. Capital letters indicate Inventor macros: SO_NODE_ADD_FIELD(), SO_KIT_INIT_CLASS(). Code examples are in Courier font.
Programming tips are marked with their own heading and the icon shown at the right.
Figure I-1 shows the symbols used in the scene graph diagrams that appear throughout this book.
For basic information about programming with the Open Inventor Toolkit, see the following:
Wernecke, Josie, The Inventor Mentor. Reading,Mass.:Addison-Wesley, 1994.
For a general introduction to computer graphics, see the following:
Foley, J.D., A. van Dam, S. Feiner, and J.F. Hughes, Computer Graphics Principles and Practice, 2d ed. Reading, Mass.: Addison-Wesley, 1990.
Neider, Jackie, Tom Davis, Mason Woo. OpenGL Programming Guide. Reading, Mass.: Addison-Wesley, 1993.
Newman, W., and R. Sproull, Principles of Interactive Computer Graphics, 2d edition. New York: McGraw-Hill, 1979.
For an introduction to the C++ language, see the following:
Lippman, Stanley, C++ Primer. AT&T Bell Laboratories, 1989.
Pohl, Ira, C++ for C Programmers. Redwood City, Ca.: Benjamin/Cummings Publishing Company, 1994.
Shapiro, Jonathan, A C++ Toolkit. Englewood Cliffs, N.J.: Prentice Hall, 1990.
For an introduction to object-oriented programming, see the following:
Meyer, Bertrand, Object-Oriented Software Construction. London: Prentice Hall International, 1988.