FCDocument/FCDCamera.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2007 Feeling Software Inc.
00003     Portions of the code are:
00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
00005     
00006     MIT License: http://www.opensource.org/licenses/mit-license.php
00007 */
00008 /*
00009     Based on the FS Import classes:
00010     Copyright (C) 2005-2006 Feeling Software Inc
00011     Copyright (C) 2005-2006 Autodesk Media Entertainment
00012     MIT License: http://www.opensource.org/licenses/mit-license.php
00013 */
00014 
00020 #ifndef _FCD_CAMERA_H_
00021 #define _FCD_CAMERA_H_
00022 
00023 #ifndef _FCD_TARGETED_ENTITY_H_
00024 #include "FCDocument/FCDTargetedEntity.h"
00025 #endif // _FCD_TARGETED_ENTITY_H_
00026 #ifndef _FCD_PARAMETER_ANIMATABLE_H_
00027 #include "FCDocument/FCDParameterAnimatable.h"
00028 #endif // _FCD_PARAMETER_ANIMATABLE_H_
00029 
00030 class FCDocument;
00031 class FCDSceneNode;
00032 
00052 class FCOLLADA_EXPORT FCDCamera : public FCDTargetedEntity
00053 {
00054 public:
00056     enum ProjectionType
00057     {
00058         PERSPECTIVE, 
00059         ORTHOGRAPHIC 
00060     };
00061 
00062 private:
00063     DeclareObjectType(FCDTargetedEntity);
00064 
00065     // Camera flags
00066     DeclareParameter(uint32, FUParameterQualifiers::SIMPLE, projection, FC("Projection Type")); // ProjectionType enumerated-type.
00067 
00068     // Camera parameters
00069     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, viewY, FC("Vertical View"));
00070     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, viewX, FC("Horizontal View"));
00071     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, aspectRatio, FC("Aspect Ratio"));
00072     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, nearZ, FC("Near-Z Plane Distance"));
00073     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, farZ, FC("Far-Z Plane Distance"));
00074 
00075 public:
00076     DeclareFlag(HasHorizontalView, 0);
00077     DeclareFlag(HasVerticalView, 1);
00078     DeclareFlagCount(2);
00079 
00080 public:
00083     FCDCamera(FCDocument* document);
00084 
00086     virtual ~FCDCamera();
00087 
00090     virtual Type GetType() const { return CAMERA; }
00091 
00094     inline ProjectionType GetProjectionType() const { return (ProjectionType) *projection; }
00095 
00098     inline void SetProjectionType(ProjectionType type) { projection = type; SetDirtyFlag(); }
00099 
00103     DEPRECATED(3.05A, GetProjectionType() == FCDCamera::PERSPECTIVE) inline bool IsPerspective() const { return projection == PERSPECTIVE; }
00104 
00106     DEPRECATED(3.05A, SetProjectionType(FCDCamera::PERSPECTIVE)) inline void SetPerspective() { projection = PERSPECTIVE; SetDirtyFlag(); }
00107 
00112     inline bool HasHorizontalFov() const { return GetHasHorizontalViewFlag(); }
00113 
00118     inline bool HasVerticalFov() const { return GetHasVerticalViewFlag(); }
00119 
00124     inline FCDParameterAnimatableFloat& GetFovX() { return viewX; }
00125     inline const FCDParameterAnimatableFloat& GetFovX() const { return viewX; } 
00131     inline FCDParameterAnimatableFloat& GetFovY() { return viewY; }
00132     inline const FCDParameterAnimatableFloat& GetFovY() const { return viewY; } 
00136     void SetFovX(float fovX);
00137 
00140     void SetFovY(float fovY);
00141 
00144     DEPRECATED(3.05A, GetProjectionType() == FCDCamera::ORTHOGRAPHIC) inline bool IsOrthographic() const { return projection == ORTHOGRAPHIC; }
00145 
00147     DEPRECATED(3.05A, SetProjectionType(FCDCamera::ORTHOGRAPHIC)) inline void SetOrthographic() { projection = ORTHOGRAPHIC; SetDirtyFlag(); }
00148 
00153     inline bool HasHorizontalMag() const { return GetHasHorizontalViewFlag(); }
00154 
00159     inline bool HasVerticalMag() const { return GetHasVerticalViewFlag(); }
00160 
00165     inline FCDParameterAnimatableFloat& GetMagX() { return viewX; }
00166     inline const FCDParameterAnimatableFloat& GetMagX() const { return viewX; } 
00172     inline FCDParameterAnimatableFloat& GetMagY() { return viewY; }
00173     inline const FCDParameterAnimatableFloat& GetMagY() const { return viewY; } 
00177     inline void SetMagX(float magX) { return SetFovX(magX); }
00178 
00181     inline void SetMagY(float magY) { return SetFovY(magY); }
00182 
00188     inline FCDParameterAnimatableFloat& GetNearZ() { return nearZ; }
00189     inline const FCDParameterAnimatableFloat& GetNearZ() const { return nearZ; } 
00195     inline FCDParameterAnimatableFloat& GetFarZ() { return farZ; }
00196     inline const FCDParameterAnimatableFloat& GetFarZ() const { return farZ; } 
00200     inline bool HasAspectRatio() const { return !(GetHasVerticalViewFlag() && GetHasHorizontalViewFlag()); }
00201 
00208     inline FCDParameterAnimatableFloat& GetAspectRatio() { return aspectRatio; }
00209     inline const FCDParameterAnimatableFloat& GetAspectRatio() const { return aspectRatio; } 
00217     inline void SetNearZ(float _nearZ) { nearZ = _nearZ; SetDirtyFlag(); }
00218 
00224     inline void SetFarZ(float _farZ) { farZ = _farZ; SetDirtyFlag(); }
00225 
00228     void SetAspectRatio(float aspectRatio);
00229 };
00230 
00231 #endif // _FCD_CAMERA_H_
00232 

Generated on Thu Feb 14 16:58:33 2008 for FCollada by  doxygen 1.4.6-NO