fbrenderer.h

Go to the documentation of this file.
00001 #ifndef __FBRENDERER_H__
00002 #define __FBRENDERER_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 
00043 #include <kaydaradef.h>
00044 #ifndef FBSDK_DLL 
00045 
00048     #define FBSDK_DLL K_DLLIMPORT
00049 #endif
00050 
00051 #if !defined(K_NO_MANIPULATOR)
00052     #include <fbsdk/fbmanipulator.h>
00053 #endif
00054 
00055 #include <fbsdk/fbcomponent.h>
00056 #include <fbsdk/fbmodel.h>
00057 #include <fbcontrols/fbcontrols.h>  // FBInputType
00058 
00059 #ifdef FBSDKUseNamespace
00060     namespace FBSDKNamespace {
00061 #endif
00062 
00063 __FB_FORWARD( FBRenderer );
00064 FB_FORWARD( FBView );
00065 
00066 FB_DEFINE_COMPONENT( FBSDK_DLL, Renderer );
00067 
00068 FB_FORWARD( FBViewingOptions );
00069 
00071 enum FBDisplayMode {
00072     kFBDisplayModeDefault = 0,  
00073     kFBDisplayModeTexture,      
00074     kFBDisplayModeHardShade,    
00075     kFBDisplayModeFlatShade,    
00076     kFBDisplayModeWireFrame,    
00077     kFBDisplayModeCount         
00078 };
00079 
00080 enum FBStereoDisplayMode   
00081 {
00082     kFBStereoDisplayCenterEye = 0,          
00083     kFBStereoDisplayLeftEye,                
00084     kFBStereoDisplayRightEye,               
00085     kFBStereoDisplayActive,                 
00086     kFBStereoDisplayHorizontalInterlace,    
00087     kFBStereoDisplayCheckerboard,           
00088     kFBStereoDisplayAnaglyph,               
00089     kFBStereoDisplayAnaglyphLuminance,       
00090     kFBStereoDisplayFreeviewParallel,       
00091     kFBStereoDisplayFreeviewCrossed,        
00092     kFBStereoDisplayModeCount = 10          
00093 };
00094 
00096 
00099 enum FBDisplayWhat {
00100     kFBDisplayNone      = 0,            
00101     kFBDisplayNull      = (1 << 0),     
00102     kFBDisplayMarker    = (1 << 1),     
00103     kFBDisplaySkeleton  = (1 << 2),     
00104     kFBDisplayCenter    = (1 << 3),     
00105     kFBDisplayLight     = (1 << 4),     
00106     kFBDisplayCamera    = (1 << 5),     
00107     kFBDisplay3dIcon    = (1 << 6),     
00108     kFBDisplayAll       = 0xff          
00109 };
00110 
00112 
00113 enum FBPickingMode {
00114     kFBPickingModeStandard = 0,     
00115     kFBPickingModeXRay,             
00116     kFBPickingModeModelsOnly,       
00117     kFBPickingModeCount             
00118 };
00119 
00121 
00122 enum FBDeviceKeyboardKey {
00123     kFBDKeyPageUp,          
00124     kFBDKeyPageDown,        
00125     kFBDKeyEnd,             
00126     kFBDKeyHome,            
00127     kFBDKeyArrowLeft,       
00128     kFBDKeyArrowUp,         
00129     kFBDKeyArrowRight,      
00130     kFBDKeyArrowDown,       
00131     kFBDKeyReturn,          
00132     kFBDKeyEscape,          
00133     kFBDKeySpace,           
00134     kFBDKey1,               
00135     kFBDKey2,               
00136     kFBDKey3,               
00137     kFBDKey4,               
00138     kFBDKey5,               
00139     kFBDKey6,               
00140     kFBDKey7,               
00141     kFBDKey8,               
00142     kFBDKey9,               
00143     kFBDKey0,               
00144     kFBDKeyF1,              
00145     kFBDKeyF2,              
00146     kFBDKeyF3,              
00147     kFBDKeyF4,              
00148     kFBDKeyF5,              
00149     kFBDKeyF6,              
00150     kFBDKeyF7,              
00151     kFBDKeyF8,              
00152     kFBDKeyF9,              
00153     kFBDKeyF10,             
00154     kFBDKeyF11,             
00155     kFBDKeyF12              
00156 };
00157 
00158 FB_DEFINE_ENUM( FBSDK_DLL, DeviceKeyboardKey );
00159 
00163 class FBSDK_DLL FBViewingOptions
00164 {
00165   public:
00169     FBModelShadingMode& ShadingMode();
00170 
00174     FBStereoDisplayMode& StereoDisplayMode();
00175 
00179     int& DisplayWhat();
00180 
00184     FBPickingMode& PickingMode();
00185 
00188     bool& ShowTimeCode();
00189 
00192     bool& ShowSafeArea();
00193 
00196     bool& ShowCameraLabel();
00197 
00198   private:
00199     FBViewingOptions();
00200     FBViewingOptions(const FBViewingOptions &);
00201     FBViewingOptions & operator =(const FBViewingOptions &);
00202 };
00203 
00204 
00206 // FBPickInfos
00208 
00235 
00236 struct FBPickInfos {
00241     FBPickInfos( HFBModel pModel, FBVector3d pPoint ) : mModel( pModel ), mPoint( pPoint ) {};
00242     HFBModel   mModel;  
00243     FBVector3d mPoint;  
00244 };
00245 
00246 bool operator==( const FBPickInfos& pLhs, const FBPickInfos& pRhs );
00247 
00249 typedef class FBSDK_DLL FBArrayTemplate<FBPickInfos> FBPickInfosList;
00250 
00252 // FBViewerInfos
00254 __FB_FORWARD( FBViewerInfos ); 
00255 FB_DEFINE_COMPONENT( FBSDK_DLL, ViewerInfos );
00256 
00274 class FBSDK_DLL FBViewerInfos : public FBComponent 
00275 {
00276     //--- Open Reality declaration.
00277     __FBClassDeclare( FBViewerInfos, FBComponent );
00278 
00283     FBViewerInfos( const FBViewerInfos& );
00284 
00289     FBViewerInfos& operator=( const FBViewerInfos& );
00290 
00291 public:
00292 
00294     FBViewerInfos( HIObject pObject );
00295 
00296     FBPropertyBool Visibility;  
00297 };
00298 
00299 
00301 // FBRenderer
00303 
00305 class FBSDK_DLL FBRenderer : public FBComponent 
00306 {
00307     //--- Open Reality declaration.
00308     __FBClassDeclare( FBRenderer,FBComponent );
00309   public:
00315     FBRenderer(HIObject pObject);
00316 
00317     //--- Rendering manipulation
00325     void SetViewport(int pX,int pY,int pW,int pH);
00326 
00336     bool RenderBegin(int pX,int pY,int pW,int pH);
00337 
00343     bool RenderEnd(HFBView pView=NULL);
00344 
00357     bool PreRender(int pLayer = -1);
00358 
00363     bool Render(int pLayer = -1);
00364 
00368     bool SetViewingOptions(FBViewingOptions & pOptions);
00369 
00373     FBViewingOptions * GetViewingOptions();
00374 
00379     bool FrameCurrentCameraWithModels(bool pAll);
00380 
00381     //--- Camera manipulation, Manipulators
00391     bool MouseInput(int pX,int pY,FBInputType pInputType,int pButtonKey,FBInputModifier pModifier,int pLayer = -1);
00392 
00400     bool Pick(int pX, int pY, FBPickInfosList& pPickInfosList, bool pNeedIntersectPoistion = false );
00401 
00407     void KeyboardInput(FBDeviceKeyboardKey pKeyIndex, bool pKeyState, bool pIsTrigger = false);
00408 
00409     // Properties
00410     FBPropertyCamera                CurrentCamera;          
00411     FBPropertyBool                  UseCameraSwitcher;      
00412 
00413 #if !defined(K_NO_MANIPULATOR)
00414     FBPropertyManipulatorTransform  ManipulatorTransform;   
00415     FBPropertyListManipulator       Manipulators;           
00416 #endif
00417 
00418     FBPropertyScene                 Scene;                  
00419     FBPropertyBool                  AutoEvaluate;           
00420     FBPropertyBool                  Background;             
00421     FBPropertyBool                  ShowStats;              
00422     FBPropertyBool                  DisplayNormals;         
00423     FBPropertyViewerInfos           ViewerInfos;            
00424 };
00425 
00426 #ifdef FBSDKUseNamespace
00427     }
00428 #endif
00429 #endif /* this must be the last line of this file */