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 <fbsdk/fbshader.h>
00058 
00059 #include <fbcontrols/fbcontrols.h>  // FBInputType
00060 
00061 #ifdef FBSDKUseNamespace
00062     namespace FBSDKNamespace {
00063 #endif
00064 
00065 __FB_FORWARD( FBRenderer );
00066 FB_FORWARD( FBView );
00067 
00068 FB_DEFINE_COMPONENT( FBSDK_DLL, Renderer );
00069 
00070 FB_FORWARD( FBViewingOptions );
00071 
00073 enum FBDisplayMode {
00074     kFBDisplayModeDefault = 0,  
00075     kFBDisplayModeTexture,      
00076     kFBDisplayModeHardShade,    
00077     kFBDisplayModeFlatShade,    
00078     kFBDisplayModeWireFrame,    
00079     kFBDisplayModeCount         
00080 };
00081 
00082 enum FBStereoDisplayMode   
00083 {
00084     kFBStereoDisplayCenterEye = 0,          
00085     kFBStereoDisplayLeftEye,                
00086     kFBStereoDisplayRightEye,               
00087     kFBStereoDisplayActive,                 
00088     kFBStereoDisplayHorizontalInterlace,    
00089     kFBStereoDisplayCheckerboard,           
00090     kFBStereoDisplayAnaglyph,               
00091     kFBStereoDisplayAnaglyphLuminance,       
00092     kFBStereoDisplayFreeviewParallel,       
00093     kFBStereoDisplayFreeviewCrossed,        
00094     kFBStereoDisplayModeCount = 10          
00095 };
00096 
00097 
00099 
00102 enum FBDisplayWhat {
00103     kFBDisplayNone      = 0,            
00104     kFBDisplayNull      = (1 << 0),     
00105     kFBDisplayMarker    = (1 << 1),     
00106     kFBDisplaySkeleton  = (1 << 2),     
00107     kFBDisplayCenter    = (1 << 3),     
00108     kFBDisplayLight     = (1 << 4),     
00109     kFBDisplayCamera    = (1 << 5),     
00110     kFBDisplay3dIcon    = (1 << 6),     
00111     kFBDisplayAll       = 0xff          
00112 };
00113 
00115 
00116 enum FBPickingMode {
00117     kFBPickingModeStandard = 0,     
00118     kFBPickingModeXRay,             
00119     kFBPickingModeModelsOnly,       
00120     kFBPickingModeCount             
00121 };
00122 
00124 
00125 enum FBDeviceKeyboardKey {
00126     kFBDKeyPageUp,          
00127     kFBDKeyPageDown,        
00128     kFBDKeyEnd,             
00129     kFBDKeyHome,            
00130     kFBDKeyArrowLeft,       
00131     kFBDKeyArrowUp,         
00132     kFBDKeyArrowRight,      
00133     kFBDKeyArrowDown,       
00134     kFBDKeyReturn,          
00135     kFBDKeyEscape,          
00136     kFBDKeySpace,           
00137     kFBDKey1,               
00138     kFBDKey2,               
00139     kFBDKey3,               
00140     kFBDKey4,               
00141     kFBDKey5,               
00142     kFBDKey6,               
00143     kFBDKey7,               
00144     kFBDKey8,               
00145     kFBDKey9,               
00146     kFBDKey0,               
00147     kFBDKeyF1,              
00148     kFBDKeyF2,              
00149     kFBDKeyF3,              
00150     kFBDKeyF4,              
00151     kFBDKeyF5,              
00152     kFBDKeyF6,              
00153     kFBDKeyF7,              
00154     kFBDKeyF8,              
00155     kFBDKeyF9,              
00156     kFBDKeyF10,             
00157     kFBDKeyF11,             
00158     kFBDKeyF12              
00159 };
00160 
00161 FB_DEFINE_ENUM( FBSDK_DLL, DeviceKeyboardKey );
00162 
00166 class FBSDK_DLL FBViewingOptions
00167 {
00168   public:
00171     FBCamera*   GetViewingCamera();
00172 
00176     FBModelShadingMode& ShadingMode();
00177 
00181     FBStereoDisplayMode& StereoDisplayMode();
00182 
00183 
00187     int& DisplayWhat();
00188 
00192     FBPickingMode& PickingMode();
00193 
00196     bool& ShowTimeCode();
00197 
00200     bool& ShowSafeArea();
00201 
00204     bool& ShowCameraLabel();
00205 
00208     bool InPicking() const;
00209 
00210   private:
00211     FBViewingOptions();
00212     FBViewingOptions(const FBViewingOptions &);
00213     FBViewingOptions & operator =(const FBViewingOptions &);
00214 };
00215 
00216 
00218 // FBPickInfos
00220 
00247 
00248 struct FBPickInfos {
00253     FBPickInfos( FBModel* pModel, FBVector3d pPoint ) : mModel( pModel ), mPoint( pPoint ) {};
00254     FBModel*   mModel;  
00255     FBVector3d mPoint;  
00256 };
00257 
00258 bool operator==( const FBPickInfos& pLhs, const FBPickInfos& pRhs );
00259 
00261 typedef class FBSDK_DLL FBArrayTemplate<FBPickInfos> FBPickInfosList;
00262 
00263 
00264 
00266 // FBRenderer
00268 
00270 class FBSDK_DLL FBRenderer : public FBComponent 
00271 {
00272     //--- Open Reality declaration.
00273     __FBClassDeclare( FBRenderer,FBComponent );
00274   public:
00280     FBRenderer(HIObject pObject);
00281 
00282     //--- Rendering manipulation
00290     void SetViewport(int pX,int pY,int pW,int pH);
00291 
00301     bool RenderBegin(int pX,int pY,int pW,int pH);
00302 
00308     bool RenderEnd(HFBView pView=NULL);
00309 
00322     bool PreRender(int pLayer = -1);
00323 
00328     bool Render(int pLayer = -1);
00329 
00333     bool SetViewingOptions(FBViewingOptions & pOptions);
00334 
00338     FBViewingOptions * GetViewingOptions();
00339 
00344     bool FrameCurrentCameraWithModels(bool pAll);
00345 
00346     //--- Camera manipulation, Manipulators
00356     bool MouseInput(int pX,int pY,FBInputType pInputType,int pButtonKey,FBInputModifier pModifier,int pLayer = -1);
00357 
00368     bool MouseInputNormalized(float pX,float pY,FBInputType pInputType,int pButtonKey,FBInputModifier pModifier,int pLayer = -1, int pPaneId = -1);
00369 
00377     bool Pick(int pX, int pY, FBPickInfosList& pPickInfosList, bool pNeedIntersectPosition = false );
00378 
00387     bool PickNormalized(float pX, float pY, FBPickInfosList& pPickInfosList, bool pNeedIntersectPosition = false, int pPaneId = -1);
00388 
00396     bool RectPick(int pX1, int pY1, int pX2, int pY2, FBPickInfosList& pPickInfosList);
00397 
00406     bool RectPickNormalized(float pX1, float pY1, float pX2, float pY2, FBPickInfosList& pPickInfosList, int pPaneId = -1);
00407 
00413     void KeyboardInput(FBDeviceKeyboardKey pKeyIndex, bool pKeyState, bool pIsTrigger = false);
00414 
00420     FBModel* GetDisplayableGeometry(int pIndex );
00421 
00427     FBLight* GetDisplayableLight(int pIndex );
00428 
00438     const FBModelList& GetDisplayableGeometryInCameraFrustum(FBModelList* pModelList = NULL, FBCamera* pCamera = NULL);
00439 
00447     bool IsModelInsideCameraFrustum(FBModel* pGeometry, FBCamera* pCamera = NULL);
00448 
00449 
00450     // Properties
00451     FBPropertyCamera                CurrentCamera;          
00452     FBPropertyBool                  UseCameraSwitcher;      
00453 
00454 #if !defined(K_NO_MANIPULATOR)
00455     FBPropertyManipulatorTransform  ManipulatorTransform;   
00456     FBPropertyListManipulator       Manipulators;           
00457 #endif
00458 
00459     FBPropertyScene                 Scene;                  
00460     FBPropertyBool                  AutoEvaluate;           
00461     FBPropertyBool                  Background;             
00462     FBPropertyBool                  ShowStats;              
00463     FBPropertyBool                  FrustumCulling;         
00464     FBPropertyBool                  DisplayNormals;         
00465     FBPropertyBool                  IDBufferPicking;        
00466     FBPropertyDouble                IDBufferPickingAlpha;   
00467     FBPropertyBool                  IDBufferDisplay;        
00468     FBPropertyBool                  SelectionOverride;      
00469     FBPropertyDouble                SelectionOverrideTransparency;  
00470     FBPropertyColor                 SelectionOverrideColor; 
00471     FBPropertyInt                   DisplaySetUpdateId;     
00472     FBPropertyInt                   RendererUpdateId;       
00473     FBPropertyInt                   DisplayableGeometryCount;
00474     FBPropertyInt                   DisplayableLightCount;   
00475     FBPropertyBool                  AdvancedMaterialMode;   
00476 };
00477 
00478 #ifdef FBSDKUseNamespace
00479     }
00480 #endif
00481 #endif /* this must be the last line of this file */