-
Notifications
You must be signed in to change notification settings - Fork 109
Base classes
You are here: Home → Documentation → Mac information page → Sc21 → Base classes
SCSceneGraph, <SCDrawable>, SCController
SCSceneGraph
An SCSceneGraph encapsulates a Coin scenegraph and provides an abstraction for reading Inventor and VRML files. [API doc]
SCSceneGraph also lets you control superscenegraph creation: When a scene is read that contains no light or no camera, obviously nothing would be visible, so by default we insert a light or camera if none is found. A checkbox in the IB inspector makes it possible to turn this off. For more control over superscenegraph creation, you can also implement the delegate method
- (SoGroup *)createSuperSceneGraph:(SoGroup *)scenegraph;
which will then be called instead of the default implementation whenever a new scenegraph is loaded. (Refer to the API documentation for more information on the scengraph delegate.)
<SCDrawable>
SCDrawable is a formal protocol. (//What's this?//) [API doc]
@protocol SCDrawable - (void)display;
- (NSRect)frame;
@end
In most cases, you will never have to deal with SCDrawable directly. Sc21 contains an SCView class that conforms to the SCDrawable protocol; when connecting SCView's controller outlet, the controller's drawable is automatically set to be that view.
SCView behaves like an NSView in every way, except for one detail: Instead of handling events directly, it forwards them to its SCController (calling SCController::handleEvent).
However, if your application is running in fullscreen mode, you do not have a view. In this case, you have to create an NSObject subclass that conforms to the SCDrawable protocol by implementing those two methods (drawing, and reporting position and size), instantiate it, and set it to be the controller's drawable.
SCController
SCController is responsible for actually doing the rendering, using Coin. [API doc]
SCController is also sent all events received by the drawable, and passes them on to its SCEventHandler(s).
SCController, SCView and SCScenegraph are all you need for basic rendering. The fundamentals of how to do this are outlined in the Sc21 Tutorial, Part 1 Introduction.