TumblerSource/Tumbler_document.h

// Tumbler_Document.h
//
// Document related data structures and function prototypes for the 
// document type used in the Tumbler application
//
// Modification History
//
//  11/26/94        nick        initial cut - symantec proto_helper app, add defines
//                              and strip stuff from the globals.h file
//  01/24/95        nick        add field for backfacing style
 
#ifndef _Tumbler_DOCUMENT_H_
#define _Tumbler_DOCUMENT_H_
 
 
#include "Tumbler_Offscreen.h"
 
//  Data Structures.
 
typedef struct WindowOffscreen {
    CGrafPtr        windowPort;
    GDHandle        windowDevice;
    GWorldPtr       offscreenWorld;
} WindowOffscreen;
 
//  Data Structures.
 
 
#define kTumblerDefaultClearColor   0.8
 
typedef struct _DocumentRecord {
    WindowPtr               theWindow;
    FSSpec                  theFileSpec ;
    short                   fRefNum;
    short                   dirty;
    
#ifdef PODIUM_APP
    // the main difference between Tumbler and podium is that 
    // podium has a background picture that is displayed behind
    // the group, and that the group uses a pixmap draw context
    // which is variable sized and "floats" above the background 
    // picture.  To make this work, we need 2 extra GWorlds, one
    // for the BG picture and one to attach to the pixmap draw 
    // context
    
    GWorldPtr               bgOffscreen ;           // holds a pict the size of the main window.
    GWorldPtr               screenBuffer ;          // use for compositing to reduce flicker
                                                    // same size as the above.
                                                    
    GWorldPtr               geometriesOffscreen ;   // initially a 200x200 offscreen for the geo's.
//  GWorldPtr               maskOffscreen ;         // same size as geo's - 1 bit mask.
 
    Rect                    bgRect ;                //
    Rect                    dropArea;
    GWorldPtr               drawContextOffscreen;
    Point                   mouseLocation;
    TQ3Object               currentlySelectedObject;
    TQ3Boolean              selected;
 
#else
    TQ3ColorARGB            clearColor ;
#endif
 
 
    TQ3GroupObject          documentGroup;                              // main group for the document
    TQ3ViewObject           theView;                                    // the documents view object
    TQ3Boolean              animateLights, animateModel;                // set to true if we are animating either the lights or the model
    TQ3Boolean              light;                                      // set to true if the three lights are on
    TQ3Boolean              shaded;                                     // we provide flat, per vertext or per pixel
    TQ3GroupObject          dynamicLights;                              // the lighting for the scene
    TQ3GroupObject          light1, light2, light3;                     // these objects indicate where the lights are (i.e. they are not the lights, but
                                                                        // they indicate the location of the lights
    TQ3TransformObject      lightXform1, lightXform2, lightXform3;      // transforms for the lights (used to map to their current position)
    TQ3Matrix4x4            modelRotation;                              // the transform for the model
    TQ3InterpolationStyle   currentInterpolation;
    
    TQ3StyleObject          backfacingStyle ;                           // the style to use for backface removal
    TQ3ShaderObject         illuminationShader ;
 
    TQ3Point3D              documentGroupCenter;
 
    float                   documentGroupScale;
    
    TQ3SharedObject         viewHints;                                  // ViewHints for this doc
 
    TQ3Vector3D             rotationDir;
} DocumentRecord, *DocumentPtr, **DocumentHandle ;
 
/* Tumbler_offscreen.c */
TQ3Status DrawOffscreen(DocumentPtr theDocument);
void DrawOnscreen(DocumentPtr theDocument);
 
 
// Tumbler_document.c 
void        AdjustDocumentView(DocumentPtr theDocument);
void        AdjustScrollBar(DocumentPtr theDocument);
void        PositionDocumentParts(DocumentPtr theDocument);
 
DocumentPtr NewDocument( TQ3SharedObject viewHints, TQ3GroupObject group );
 
Boolean     CloseDocument(DocumentPtr theDocument);
Boolean     CloseAllDocuments(void);
 
void        DoActivateDocument(DocumentPtr theDocument, short activate);
DocumentPtr GetDocumentFromWindow(WindowPtr theWindow);
 
TQ3Status InitializeGroup(TQ3GroupObject group);
 
 
TQ3Status           TumblerDocument_NewLights( DocumentPtr theDocument ) ;
TQ3CameraObject         TumblerDocument_NewCamera(WindowPtr theWindow);
TQ3DrawContextObject    TumblerDocument_NewDrawContext(WindowPtr theWindow);
TQ3Status           TumblerDocument_UpdateView( DocumentPtr theDocument, TQ3SharedObject viewHints ) ;
 
#ifdef PODIUM_APP
// these functions are needed only for podium
TQ3DrawContextObject TumblerDocument_NewPixmapDrawContext(DocumentPtr theDocument) ;
#endif
 
#endif