FCDocument/FCDLight.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 /*
00006     Based on the FS Import classes:
00007     Copyright (C) 2005-2006 Feeling Software Inc
00008     Copyright (C) 2005-2006 Autodesk Media Entertainment
00009     MIT License: http://www.opensource.org/licenses/mit-license.php
00010 */
00011 
00017 #ifndef _FCD_LIGHT_H_
00018 #define _FCD_LIGHT_H_
00019 
00020 #include "FCDocument/FCDTargetedEntity.h"
00021 #include "FUtils/FUDaeEnum.h"
00022 
00023 class FCDocument;
00024 class FCDSceneNode;
00025 
00053 class FCOLLADA_EXPORT FCDLight : public FCDTargetedEntity
00054 {
00055 public:
00057     enum LightType
00058     {
00059         POINT, 
00060         SPOT, 
00061         AMBIENT, 
00062         DIRECTIONAL 
00063     };
00064 
00065 private:
00066     DeclareObjectType;
00067 
00068     // Common Light parameters
00069     FMVector3 color;    
00070     float intensity; // Max and Maya
00071     LightType lightType;
00072 
00073     // Point and spot light parameters
00074     float constantAttenuationFactor;
00075     float linearAttenuationFactor;
00076     float quadracticAttenuationFactor;
00077 
00078     // Spot-specific light parameters
00079     float fallOffExponent;
00080     float fallOffAngle;
00081     float outerAngle; // Max-specific
00082     float penumbraAngle; // Maya-specifc: these last two are are related as 'penumbra = outerAngle - fallOffAngle'.
00083     float aspectRatio; // Max-specific, for rectangle lights
00084     float dropoff; // Maya-specific
00085 
00086     // Directional light parameters
00087     // Overshoot is a Max-specific flag that sets a directional light to cover everything,
00088     // rather than to be restricted to a cylinder defined by the fallOffAngle/outerAngle.
00089     bool overshoots; // Max-specific
00090 
00091 public:
00094     FCDLight(FCDocument* document);
00095 
00098     virtual ~FCDLight();
00099 
00102     virtual Type GetType() const { return LIGHT; }
00103 
00107     FMVector3& GetColor() { return color; }
00108     const FMVector3& GetColor() const { return color; } 
00113     void SetColor(const FMVector3& col) { color = col; }
00114 
00118     float& GetIntensity() { return intensity; }
00119     const float& GetIntensity() const { return intensity; } 
00124     void SetIntensity(float _intensity) { intensity = _intensity; }
00125 
00130     LightType GetLightType() const { return lightType; }
00131 
00134     void SetLightType(LightType type) { lightType = type; }
00135 
00139     float& GetConstantAttenuationFactor() { return constantAttenuationFactor; }
00140     const float& GetConstantAttenuationFactor() const { return constantAttenuationFactor; } 
00145     void SetConstantAttenuationFactor(float factor) { constantAttenuationFactor = factor; }
00146 
00150     float& GetLinearAttenuationFactor() { return linearAttenuationFactor; }
00151     const float& GetLinearAttenuationFactor() const { return linearAttenuationFactor; } 
00156     void SetLinearAttenuationFactor(float factor) { linearAttenuationFactor = factor; }
00157 
00161     float& GetQuadraticAttenuationFactor() { return quadracticAttenuationFactor; }
00162     const float& GetQuadraticAttenuationFactor() const { return quadracticAttenuationFactor; } 
00167     void SetQuadraticAttenuationFactor(float factor) { quadracticAttenuationFactor = factor; }
00168 
00179     float& GetFallOffExponent() { return fallOffExponent; }
00180     const float& GetFallOffExponent() const { return fallOffExponent; } 
00185     void SetFallOffExponent(float exponent) { fallOffExponent = exponent; }
00186 
00191     float& GetFallOffAngle() { return fallOffAngle; }
00192     const float& GetFallOffAngle() const { return fallOffAngle; } 
00197     void SetFallOffAngle(float angle) { fallOffAngle = angle; }
00198 
00207     float& GetOuterAngle() { return outerAngle; }
00208     const float& GetOuterAngle() const { return outerAngle; } 
00213     void SetOuterAngle(float angle) { outerAngle = angle; }
00214 
00225     float& GetPenumbraAngle() { return penumbraAngle; }
00226     const float& GetPenumbraAngle() const { return penumbraAngle; } 
00231     void SetPenumbraAngle(float angle) { penumbraAngle = angle; }
00232 
00242     float& GetAspectRatio() { return aspectRatio; }
00243     const float& GetAspectRatio() const { return aspectRatio; } 
00248     void SetAspectRatio(float ratio) { aspectRatio = ratio; }
00249     
00253     float& GetDropoff() { return dropoff; }
00254     const float& GetDropoff() const { return dropoff; } 
00259     void SetDropoff(float factor) { dropoff = factor; }
00260 
00268     bool DoesOvershoot() const { return overshoots; }
00269 
00273     void SetOvershoot(bool _overshoots) { overshoots = _overshoots; }
00274 
00279     FUStatus LoadFromXML(xmlNode* lightNode);
00280 
00284     virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
00285 };
00286 
00287 #endif // _FCD_LIGHT_H_
00288 

Generated on Fri May 12 16:44:38 2006 for FCollada by  doxygen 1.4.6-NO