VRMakePano.h

/*
    File:       VRMakePano.h
 
    Contains:   Code for creating a QuickTime VR panoramic movie from a panoramic image.
 
    Written by: Ken Turkowski
                Based largely on MakeQTVRPanorama code by Tim Monroe, Ed Harp (and others?).
 
    Copyright:  © 1996-2000 by Apple Computer, Inc. All rights reserved.    
 
    Change History (most recent first):
 
        $Log: VRMakePano.h,v $
        Revision 1.4  2001/04/23 18:59:50  turk
        Enable setting of preview compression parameters.
        
        Revision 1.3  2001/02/03 01:35:39  turk
        add API for specifying hot spots
        
        Revision 1.2  2000/12/22 00:23:03  turk
        Call an FSSpecHandle an FSSpecHandle, not a FSSpec**, for they differ in their access:
        sh[0][n] vs. sh[n][0].
        
        Revision 1.1  2000/11/15 23:06:45  turk
        Major rework of the API. Brought all parameters directly up to the API, rather than being
        assigned default values.
        
 
       <2>      11/24/99    rtm     minor clean-up
       <1>      12/01/98    rtm     first file
 
    To Do:
*/
 
#ifndef __VRMAKEPANO__
#define __VRMAKEPANO__
 
#ifndef __MOVIES__
# include <Movies.h>
#endif /* __MOVIES__ */
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
 
/* This struct only accommodates kQTVRHotSpotURLType or kQTVRHotSpotUndefinedType hot spots.
 * In particular, it does not accommodate kQTVRHotSpotLinkType hot spots.
 */
typedef struct VRHotSpotDefinition {
    unsigned long   index;      /* 1 <= index <= 255 */
    Handle          name;       /* Name of the hot spot */
    Handle          url;        /* URL or NULL if an undefined type hot spot */
} VRHotSpotDefinition, **VRHotSpotDefinitionHandle;
 
 
typedef struct VRMakeQTVRParams {
    long            tilesH;             /* The number of tiles horizontally ... */
    long            tilesV;             /* ... and vertically */
    
    CodecType       tileCodec;          /* Codec to be used if compression is needed */
    CodecQ          tileQuality;        /* Quality of compression to be used */
    
    CodecType       previewCodec;       /* Codec to be used for the preview */
    CodecQ          previewQuality;     /* Quality of compression to be used fro the preview */
 
    char            *sceneName;         /* Optional name to give to the whole scene */
    char            *nodeName;          /* Optional name to give to this node */
 
    CodecQ          dynamicQuality;     /* Rendering quality to use during panning */
    CodecQ          staticQuality;      /* Rendering quality to use after  panning */
    
    TimeValue       trackDuration;      /* 7200, 3600, or other suitable number */
 
    /* Media limits - in degrees */
    long            wraps;              /* The panorama wraps around - or not */
    float           minPan;
    float           maxPan;
    float           minTilt;
    float           maxTilt;
    float           minFieldOfView;
    float           maxFieldOfView;
 
    /* Initial view */
    float           defaultPan;         /* Pan angle at center of window */
    float           defaultTilt;
    float           defaultFieldOfView;
    long            windowWidth;        /* Width  of the desired viewing window */
    long            windowHeight;       /* Height of the desired viewing window */
    
    /* Hot spot definitions */
    VRHotSpotDefinitionHandle   hotSpots;
    
    /* Flattener directives */
    unsigned short  flattenerFlags;             /* 1=generatePreview, 2=blur */
    unsigned short  flattenerPreviewResolution; /* 0=none; 2=half, 3=third, 4=quarter, etc. */
    
} VRMakeQTVRParams;
 
 
#define kVRMakePano_GeneratePreview         1       /* These are the flattener flags */
#define kVRMakePano_BlurGeneratedPreview    2
 
 
/********************************************************************************
 ********************************************************************************
 ********************************************************************************
 ***        Cylindrical movies to cylindrical panorama movies
 ********************************************************************************
 ********************************************************************************
 ********************************************************************************/
 
 
/********************************************************************************
 * Cylindrical movie to cylindrical panorama movie version 1
 *
 * NOT RECOMMENDED - Use VRMovieToQTVRCylPano2v0 or VRMovieToQTVRCylPano2h0 instead.
 ********************************************************************************/
 
OSErr   VRMovieToQTVRCylPano1x0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            FSSpec              *srcTileSpec,   /* Cylindrical tile movie for the panoramic image */
            FSSpec              *srcHSTileSpec, /* Cylindrical tile movie for the hot spot image */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
/********************************************************************************
 * Cylindrical movie to cylindrical panorama movie version 2V - rotated source and tiles
 *
 * This converts a tile movie to a cylindrical QuickTime VR movie.
 * An optional hot spot tile movie and/or fast start movie can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * The tiles are assumed to be rotated 90 degrees counter-clockwise (i.e. up is to the left).
 * For a wrapping panoramic image of VFOV < 145 degrees, this means that the vertical
 * dimension (circumference) is larger than the horizontal (axis).
 ********************************************************************************/
 
OSErr   VRMovieToQTVRCylPano2v0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            FSSpec              *srcTileSpec,   /* Cylindrical tile movie for the panoramic image */
            FSSpec              *srcHSTileSpec, /* Cylindrical tile movie for the hot spot image */
            FSSpec              *srcFSTileSpec, /* Cylindrical tile movie for the fast start image */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
/********************************************************************************
 * Cylindrical movie to cylindrical panorama movie  version 2H - non-rotated source and tiles
 *
 * This converts a tile movie to a cylindrical QuickTime VR movie.
 * An optional hot spot tile movie and/or fast start movie can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * The images are assumed to be in normal orientation (i.e. up is toward the top - not rotated).
 * For a wrapping panoramic image of VFOV < 145 degrees, this means that the horizontal
 * dimension (circumference) is larger than the vertical (axis).
 ********************************************************************************/
 
OSErr   VRMovieToQTVRCylPano2h0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            FSSpec              *srcTileSpec,   /* Cylindrical tile movie for the panoramic image */
            FSSpec              *srcHSTileSpec, /* Cylindrical tile movie for the hot spot image */
            FSSpec              *srcFSTileSpec, /* Cylindrical tile movie for the fast start image */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
 
/********************************************************************************
 ********************************************************************************
 ********************************************************************************
 ***        Cylindrical image files to cylindrical panorama movies
 ********************************************************************************
 ********************************************************************************
 ********************************************************************************/
 
 
/********************************************************************************
 * Cylindrical image to vertical (rotated) QuickTime VR
 *
 * This converts a cylindrical image file to a cylindrical QuickTime VR movie.
 * An optional hot spot image file and/or fast start image file can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * The images are assumed to be rotated 90 degrees counter-clockwise (i.e. up is to the left).
 * For a wrapping panoramic image of VFOV < 145 degrees, this means that the vertical
 * dimension (circumference) is larger than the horizontal (axis).
 ********************************************************************************/
 
OSErr   VRPictToQTVRCylPano2v0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            FSSpec              *srcPictSpec,   /* Source     image, rotated 90 degrees counter-clockwise (classic orientation) */
            FSSpec              *srcHSPictSpec, /* Hot spot   image, rotated 90 degrees counter-clockwise (classic orientation) */
            FSSpec              *srcFSPictSpec, /* Fast start image, rotated 90 degrees counter-clockwise (classic orientation) */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
/********************************************************************************
 * Cylindrical image to horizontal QuickTime VR
 *
 * This converts a cylindrical image file to a cylindrical QuickTime VR movie.
 * An optional hot spot image file and/or fast start image file can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * The images are assumed to be in normal orientation (i.e. up is toward the top - not rotated).
 * For a wrapping panoramic image of VFOV < 145 degrees, this means that the horizontal
 * dimension (circumference) is larger than the vertical (axis).
 ********************************************************************************/
 
OSErr   VRPictToQTVRCylPano2h0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            FSSpec              *srcPictSpec,   /* Source     image, non-rotated (modern orientation) */
            FSSpec              *srcHSPictSpec, /* Hot spot   image, non-rotated (modern orientation) */
            FSSpec              *srcFSPictSpec, /* Fast start image, non-rotated (modern orientation) */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
 
/********************************************************************************
 ********************************************************************************
 ********************************************************************************
 ***        Cylindrical GWorlds to cylindrical panorama movies
 ********************************************************************************
 ********************************************************************************
 ********************************************************************************/
 
 
/********************************************************************************
 * Cylindrical GWorld to vertical (rotated) QuickTime VR
 *
 * This converts a cylindrical GWorld to a cylindrical QuickTime VR movie.
 * An optional hot spot GWorld and/or fast start GWorld can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * The images are assumed to be rotated 90 degrees counter-clockwise (i.e. up is to the left).
 * For a wrapping panoramic image of VFOV < 145 degrees, this means that the vertical
 * dimension (circumference) is larger than the horizontal (axis).
 ********************************************************************************/
 
OSErr   VRGWorldToQTVRCylPano2v0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            GWorldPtr           srcGW,          /* Source GWorld, rotated 90 degrees counter-clockwise (classic orientation) */
            GWorldPtr           srcHSGW,        /* Source hot spot GWorld, rotated 90 degrees counter-clockwise (classic orientation) */
            GWorldPtr           srcFSGW,        /* Source fast start GWorld, rotated 90 degrees counter-clockwise (classic orientation) */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
/********************************************************************************
 * Cylindrical GWorld to horizontal QuickTime VR
 *
 * This converts a cylindrical GWorld to a cylindrical QuickTime VR movie.
 * An optional hot spot GWorld and/or fast start GWorld can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * The images are assumed to be in normal orientation (i.e. up is toward the top - not rotated).
 * For a wrapping panoramic image of VFOV < 145 degrees, this means that the horizontal
 * dimension (circumference) is larger than the vertical (axis).
 ********************************************************************************/
 
OSErr   VRGWorldToQTVRCylPano2h0(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            GWorldPtr           srcGW,          /* Source GWorld, non-rotated (modern orientation) */
            GWorldPtr           srcHSGW,        /* Source hot spot GWorld, non-rotated (modern orientation) */
            GWorldPtr           srcFSGW,        /* Source fast start GWorld, non-rotated (modern orientation) */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
 
/********************************************************************************
 ********************************************************************************
 ********************************************************************************
 ***        Cubic movies/pictures/GWorlds to cubic panorama movies
 ********************************************************************************
 ********************************************************************************
 ********************************************************************************/
 
 
/********************************************************************************
 * Cubic movies to cubic panorama movies
 *
 * This converts a movie with 6 frames into a cubic QuickTime VR panorama movie.
 * An optional hot spot movie and/or fast start movie can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 ********************************************************************************/
 
OSErr   VRMovieToQTVRCubicPano(
            VRMakeQTVRParams    *qtvrParams,        /* Parameters used to create the movie */
            FSSpec              *srcFramesSpec,     /* Source movie with the panorama faces */
            FSSpec              *srcHSFramesSpec,   /* Source movie with the hot spot faces */
            FSSpec              *srcFSFramesSpec,   /* Source movie with the fast start faces */
            FSSpec              *dstMovieSpec       /* Destination movie */
        );
 
/********************************************************************************
 * Cubic picture files to cubic panorama movies
 *
 * This converts a set of 6 picture files to a cubic QuickTime VR panorama movie.
 * An optional hot spot picture files and/or fast start picture files can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * There are certain restrictions on sizes for tiling:
 * Adjacent tiles duplicate their edges, therefore the GW size should be evenly
 * divisible into tiles, taking this overlap into account. Tile size is:
 *      t = (f + n - 1) / n,     where
 * t is the tile size (width or height),
 * f is the face size (width or height - same as above),
 * n is the number of tiles in that dimension (width or height)
 * e.g. a 767x767 face is divided into 4=2x2 tiles of size 384x384
 *      a 766x766 face is divided into 9=3x3 tiles of size 256x256.
 ********************************************************************************/
 
OSErr   VRPictsToQTVRCubicPano(
            VRMakeQTVRParams    *qtvrParams,        /* Parameters used to create the movie */
            FSSpecHandle        srcPictSpecs,       /* Source     images */
            FSSpecHandle        srcHSPictSpecs,     /* Hot spot   images */
            FSSpecHandle        srcFSPictSpecs,     /* Fast start images */
            FSSpec              *dstMovieSpec       /* Destination movie */
        );
 
 
/********************************************************************************
 * Cubic GWorlds to cubic panorama movies
 *
 * This converts a set of 6 GWorlds to a cubic QuickTime VR panorama movie.
 * An optional hot spot GWorlds and/or fast start GWorlds can also be specified.
 * The window dimensions, tiling, track duration, compression codec,
 * compression qualities and rendering qualities (static and dynamic) are mandatory.
 *
 * There are certain restrictions on sizes for tiling:
 * Adjacent tiles duplicate their edges, therefore the GW size should be evenly
 * divisible into tiles, taking this overlap into account. Tile size is:
 *      t = (f + n - 1) / n,     where
 * t is the tile size (width or height),
 * f is the face size (width or height - same as above),
 * n is the number of tiles in that dimension (width or height)
 * e.g. a 767x767 face is divided into 4=2x2 tiles of size 384x384
 *      a 766x766 face is divided into 9=3x3 tiles of size 256x256.
 ********************************************************************************/
 
OSErr   VRGWorldsToQTVRCubicPano(
            VRMakeQTVRParams    *qtvrParams,    /* Parameters used to create the movie */
            GWorldPtr           *srcGWs,        /* Source GWorlds - in standard order */
            GWorldPtr           *srcHSGWs,      /* Source hot spot GWorlds - in standard order */
            GWorldPtr           *srcFSGWs,      /* Source fast start GWorlds - in standard order */
            FSSpec              *dstMovieSpec   /* Destination movie */
        );
 
 
 
#ifdef __cplusplus
}
#endif /* __cplusplus */
 
#endif /* __VRMAKEPANO__ */