FCDocument/FCDLight.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_LIGHT_H_
00021 #define _FCD_LIGHT_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 class FCDAnimated;
00033 
00061 class FCOLLADA_EXPORT FCDLight : public FCDTargetedEntity
00062 {
00063 public:
00065     enum LightType
00066     {
00067         POINT, 
00068         SPOT, 
00069         AMBIENT, 
00070         DIRECTIONAL 
00071     };
00072 
00073 private:
00074     DeclareObjectType(FCDTargetedEntity);
00075 
00076     // Common Light parameters
00077     DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::COLOR, color, FC("Color"));
00078     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, intensity, FC("Intensity")); // Non-standard COLLADA
00079     DeclareParameter(uint32, FUParameterQualifiers::SIMPLE, lightType, FC("Light Type")); // LightType
00080 
00081     // Point and spot light parameters
00082     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, constantAttenuationFactor, FC("Constant Attenuation Factor"));
00083     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, linearAttenuationFactor, FC("Linear Attenuation Factor"));
00084     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, quadracticAttenuationFactor, FC("Quadratic Attenuation Factor"));
00085 
00086     // Spot-specific light parameters
00087     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, fallOffExponent, FC("Fall-off Exponent")); // Likely to be deprecated in future versions.
00088     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, fallOffAngle, FC("Inner Cone Angle"));
00089     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, outerAngle, FC("Outer Cone Angle")); // Non-standard COLLADA
00090     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, penumbraAngle, FC("Penumbra Angle")); // *** DEPRECATED *** Replaced with the inner/outer angle.
00091     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, dropoff, FC("Drop-off"));
00092 
00093 public:
00096     FCDLight(FCDocument* document);
00097 
00099     virtual ~FCDLight();
00100 
00103     virtual Type GetType() const { return LIGHT; }
00104 
00109     DEPRECATED(3.05A, GetExtra()->GetDefaultType()->GetTechniques()) virtual bool HasMaxExtras() const { return false; }
00110     DEPRECATED(3.05A, GetExtra()->GetDefaultType()->GetTechniques()) virtual bool HasMayaExtras() const { return false; } 
00116     DEPRECATED(3.05A, nothing) void SetHasMaxExtras(bool UNUSED(value)) { }
00117     DEPRECATED(3.05A, nothing) void SetHasMayaExtras(bool UNUSED(value)) { }
00118 
00122     FCDParameterAnimatableColor3& GetColor() { return color; }
00123     const FCDParameterAnimatableColor3& GetColor() const { return color; } 
00128     void SetColor(const FMVector3& col) { color = col; SetDirtyFlag(); }
00129 
00135     void SetColor(float r, float g, float b) { color = FMVector3(r, g, b); SetDirtyFlag(); }
00136 
00140     FCDParameterAnimatableFloat& GetIntensity() { return intensity; }
00141     const FCDParameterAnimatableFloat& GetIntensity() const { return intensity; } 
00146     void SetIntensity(float _intensity) { intensity = _intensity; SetDirtyFlag(); }
00147 
00152     LightType GetLightType() const { return (LightType) *lightType; }
00153 
00156     void SetLightType(LightType type) { lightType = type; SetDirtyFlag(); }
00157 
00161     FCDParameterAnimatableFloat& GetConstantAttenuationFactor() { return constantAttenuationFactor; }
00162     const FCDParameterAnimatableFloat& GetConstantAttenuationFactor() const { return constantAttenuationFactor; } 
00167     void SetConstantAttenuationFactor(float factor) { constantAttenuationFactor = factor; SetDirtyFlag(); }
00168 
00172     FCDParameterAnimatableFloat& GetLinearAttenuationFactor() { return linearAttenuationFactor; }
00173     const FCDParameterAnimatableFloat& GetLinearAttenuationFactor() const { return linearAttenuationFactor; } 
00178     void SetLinearAttenuationFactor(float factor) { linearAttenuationFactor = factor; SetDirtyFlag(); }
00179 
00183     FCDParameterAnimatableFloat& GetQuadraticAttenuationFactor() { return quadracticAttenuationFactor; }
00184     const FCDParameterAnimatableFloat& GetQuadraticAttenuationFactor() const { return quadracticAttenuationFactor; } 
00189     void SetQuadraticAttenuationFactor(float factor) { quadracticAttenuationFactor = factor; SetDirtyFlag(); }
00190 
00201     FCDParameterAnimatableFloat& GetFallOffExponent() { return fallOffExponent; }
00202     const FCDParameterAnimatableFloat& GetFallOffExponent() const { return fallOffExponent; } 
00207     void SetFallOffExponent(float exponent) { fallOffExponent = exponent; SetDirtyFlag(); }
00208 
00213     FCDParameterAnimatableFloat& GetFallOffAngle() { return fallOffAngle; }
00214     const FCDParameterAnimatableFloat& GetFallOffAngle() const { return fallOffAngle; } 
00219     void SetFallOffAngle(float angle) { fallOffAngle = angle; SetDirtyFlag(); }
00220 
00229     FCDParameterAnimatableFloat& GetOuterAngle() { return outerAngle; }
00230     const FCDParameterAnimatableFloat& GetOuterAngle() const { return outerAngle; } 
00235     void SetOuterAngle(float angle) { outerAngle = angle; SetDirtyFlag(); }
00236 
00249     DEPRECATED(3.05A, GetOuterAngle and GetFallOffAngle) float& GetPenumbraAngle() { return penumbraAngle; }
00250     DEPRECATED(3.05A, GetOuterAngle and GetFallOffAngle) const float& GetPenumbraAngle() const { return penumbraAngle; } 
00257     DEPRECATED(3.05A, SetOuterAngle and SetFallOffAngle) void SetPenumbraAngle(float angle) { penumbraAngle = angle; }
00258     
00263     FCDParameterAnimatableFloat& GetDropoff() { return dropoff; }
00264     const FCDParameterAnimatableFloat& GetDropoff() const { return dropoff; } 
00268     void SetDropoff(float factor) { dropoff = factor; SetDirtyFlag(); }
00269 };
00270 
00271 #endif // _FCD_LIGHT_H_
00272 

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