00001 #ifndef __FBRENDERER_H__
00002 #define __FBRENDERER_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
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>
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
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
00268
00270 class FBSDK_DLL FBRenderer : public FBComponent
00271 {
00272
00273 __FBClassDeclare( FBRenderer,FBComponent );
00274 public:
00280 FBRenderer(HIObject pObject);
00281
00282
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
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
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