fbtracker.h

Go to the documentation of this file.
00001 #ifndef __FBTRACKER_H__
00002 #define __FBTRACKER_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00042 #include <kaydaradef.h>
00043 #ifndef FBSDK_DLL 
00044 
00047     #define FBSDK_DLL K_DLLIMPORT
00048 #endif
00049 
00050 #include <fbsdk/fbcomponent.h>
00051 #include <fbsdk/fbcore.h>
00052 
00053 #ifdef FBSDKUseNamespace
00054     namespace FBSDKNamespace {
00055 #endif
00056 
00057 /**************************************************************************
00058  **************************************************************************/
00060 FBSDK_DLL FBTimeMode FBGetSyncTimeMode();
00061 
00062 /**************************************************************************
00063  **************************************************************************/
00064 __FB_FORWARD( FBDeviceSyncPacket );
00070 class FBSDK_DLL FBDeviceSyncPacket : public FBComponent
00071 {
00072     __FBClassDeclare( FBDeviceSyncPacket, FBComponent );
00073   public:
00074     FBDeviceSyncPacket();           
00075 
00076   public:
00077     FBPropertyInt   OriginalSync;   
00078     FBPropertyInt   CorrectedSync;  
00079     FBPropertyInt   DeviceSync;     
00080 };
00081 
00082 /**************************************************************************
00083  **************************************************************************/
00084 __FB_FORWARD( FBDeviceSync );
00089 class FBSDK_DLL FBDeviceSync : public FBDevice
00090 {
00091     __FBClassDeclare( FBDeviceSync, FBDevice );
00092   public:
00097     FBDeviceSync(char* pName, HIObject pObject=NULL);
00103     virtual void PrintDebugAnimInfo     ( int pSync, FBDeviceSyncPacket* pSyncPacket, HFBEvaluateInfo pEvaluateInfo );
00108     virtual void PrintDebugIOInfo       ( FBDeviceSyncPacket* pSyncPacket, FBDeviceNotifyInfo& pDeviceNotifyInfo );
00113     virtual void PrintDebugIONotifyInfo ( FBDeviceNotifyInfo& pInfo, int pPacketCount );
00114 
00115     // Standard device virtual functions creation/destruction
00116     virtual bool FBCreate   ();
00117     virtual void FBDestroy  ();
00118 
00119     // Overloaded FBDevice functions
00120     virtual bool AnimationNodeNotify( HFBAnimationNode pAnimationNode, HFBEvaluateInfo pEvaluateInfo    );
00121     virtual bool FbxStore           ( HFBFbxObject pFbxObject,kFbxObjectStore pStoreWhat    );
00122     virtual bool FbxRetrieve        ( HFBFbxObject pFbxObject,kFbxObjectStore pStoreWhat    );
00123 
00130     virtual bool DeviceSyncAnimationNodeNotify( HFBAnimationNode pAnimationNode, HFBEvaluateInfo pEvaluateInfo, int pCorrectedSync ) = 0;
00131 
00132     //--- Packet registration
00139     virtual void PacketRegister( HFBDeviceSyncPacket pPacket );
00140 
00141     //--- DeviceIONotify() calls
00147     virtual HFBDeviceSyncPacket PacketLock ();
00156     virtual void PacketUnlock ( HFBDeviceSyncPacket pPacket, bool pValidPacket );
00157 
00158     //--- AnimationNodeNotify() calls
00168     virtual HFBDeviceSyncPacket PacketFetch( int pRequestedSync );
00174     virtual void PacketRelease( HFBDeviceSyncPacket pPacket );
00175 
00176     //--- Queue management
00181     virtual HFBDeviceSyncPacket PacketRemove( int pPacketIndex );
00185     virtual int PacketGetCount();
00186 
00187   public:
00188     FBPropertyInt       PacketBufferSize;       
00189     FBPropertyInt       SyncDelay;              
00190     FBPropertyBool      DebugInfo;              
00191 };
00192 
00193 /**************************************************************************
00194  **************************************************************************/
00195 __FB_FORWARD( FBDeviceCameraPacket );
00199 class FBSDK_DLL FBDeviceCameraPacket : public FBDeviceSyncPacket
00200 {
00201     __FBClassDeclare( FBDeviceCameraPacket, FBDeviceSyncPacket );
00202 public:
00203     FBDeviceCameraPacket();             
00204 
00205     FBPropertyVector3d  Position;       
00206     FBPropertyVector3d  Rotation;       
00207     FBPropertyVector3d  Offset;         
00208     FBPropertyVector2d  FieldOfView;    
00209     FBPropertyVector2d  OpticalCenter;  
00210     FBPropertyDouble    Focus;          
00211     FBPropertyDouble    Zoom;           
00212     FBPropertyTime      Time;           
00213 };
00214 FB_DEFINE_COMPONENT( FBSDK_DLL, DeviceCameraPacket );
00215 
00216 /**************************************************************************
00217  **************************************************************************/
00218 __FB_FORWARD( FBDeviceCameraInstrument );
00227 class FBSDK_DLL FBDeviceCameraInstrument : public FBDeviceInstrument
00228 {
00229     __FBClassDeclare( FBDeviceCameraInstrument, FBDeviceInstrument );
00230   public:
00234     FBDeviceCameraInstrument( HFBDevice pDevice );
00235 
00240     virtual bool LoadLensTables( char* pFilename );
00247     virtual void ProcessLensData( FBDeviceCameraPacket* pDataPacket );
00248 
00249     // See parent class.
00250     virtual bool InstrumentWriteData( HFBEvaluateInfo pEvaluateInfo ) override;
00251     virtual void InstrumentRecordFrame( FBTime pRecordTime, FBDeviceNotifyInfo& pNotifyInfo ) override;
00252     virtual bool FbxStore( HFBFbxObject pFbxObject,kFbxObjectStore pStoreWhat ) override;
00253     virtual bool FbxRetrieve( HFBFbxObject pFbxObject,kFbxObjectStore pStoreWhat ) override;
00254 
00255     // Packet of information
00256     FBPropertyDeviceCameraPacket    Packet;         
00257     FBPropertyDeviceCameraPacket    RecordPacket;   
00258     // Lens options
00259     FBPropertyBool      LensTableLoaded;            
00260     FBPropertyString    LensCalibrationFilename;    
00261 
00262     FBPropertyBool      ManualFovMode;              
00263     FBPropertyDouble    ManualFovX;                 
00264     FBPropertyDouble    ManualFovY;                 
00265     FBPropertyBool      ManualCenterMode;           
00266     FBPropertyDouble    ManualCenterX;              
00267     FBPropertyDouble    ManualCenterY;              
00268     FBPropertyBool      LensFovInDegrees;           
00269     FBPropertyBool      InvertZoom;                 
00270     FBPropertyBool      InvertFocus;                
00271     FBPropertyDouble    ZoomMultiplier;             
00272     FBPropertyDouble    NodalMultiplier;            
00273     FBPropertyVector3d  TranslationOffset;          
00274     FBPropertyVector3d  RotationOffset;             
00275     FBPropertyDouble    AspectRatio;                
00276 };
00277 
00278 /**************************************************************************
00279  **************************************************************************/
00280 __FB_FORWARD( FBDeviceCamera );
00286 class FBSDK_DLL FBDeviceCamera : public FBDeviceSync
00287 {
00288     __FBClassDeclare( FBDeviceCamera,FBDeviceSync );
00289   public:
00294     FBDeviceCamera(char *pName, HIObject pObject=NULL);
00295 
00296     // Standard device virtual functions creation/destruction
00297     virtual bool FBCreate   ();
00298     virtual void FBDestroy  ();
00299 
00300     // Overloaded parent functions
00301     virtual bool DeviceSyncAnimationNodeNotify  ( HFBAnimationNode pAnimationNode, HFBEvaluateInfo pEvaluateInfo, int pCorrectedSync );
00302     virtual void DeviceIONotify                 ( kDeviceIOs pAction, FBDeviceNotifyInfo& pDeviceNotifyInfo );
00303     virtual bool ModelTemplateBindNotify( HFBModel pModel,int pIndex, HFBModelTemplate pModelTemplate       );
00304     virtual bool FbxStore               ( HFBFbxObject pFbxObject,kFbxObjectStore pStoreWhat    );
00305     virtual bool FbxRetrieve            ( HFBFbxObject pFbxObject,kFbxObjectStore pStoreWhat    );
00306     virtual void RecordingInitAnimation ( HFBAnimationNode pAnimationNode );
00307     virtual void RecordingDoneAnimation ( HFBAnimationNode pAnimationNode );
00308 
00315     virtual bool DeviceCameraAnimationNodeNotify( HFBEvaluateInfo pEvaluateInfo, HFBDeviceCameraPacket pDstPacket, HFBDeviceSyncPacket pSrcPacket );
00322     virtual void DeviceCameraEvalData( FBDeviceNotifyInfo& pNotifyInfo );
00327     virtual void DeviceCameraRecordFrame( FBTime &pRecordTime, FBDeviceNotifyInfo& pNotifyInfo );
00332     virtual bool DeviceCameraWriteData( HFBEvaluateInfo pEvaluateInfo );
00337     virtual bool LoadLensTables( char* pFilename );
00344     virtual void ProcessLensData( HFBDeviceCameraPacket pDataPacket );
00345   
00346   public:
00347     FBPropertyBool      UsingCustomInstruments; 
00348     FBPropertyInt       NumberOfInstruments;    
00349     FBPropertyString    ModelTemplatePrefix;    
00350 };
00351    
00352 #ifdef FBSDKUseNamespace
00353 }
00354 #endif
00355 #endif