FCDocument/FCDTexture.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_TEXTURE_H_
00018 #define _FCD_TEXTURE_H_
00019 
00020 #include "FCDocument/FCDEntity.h"
00021 #include "FUtils/FUDaeEnum.h"
00022 
00023 class FCDocument;
00024 class FCDEffectParameter;
00025 class FCDEffectParameterInt;
00026 class FCDEffectParameterList;
00027 class FCDImage;
00028 
00046 class FCOLLADA_EXPORT FCDTexture : public FCDEntity
00047 {
00048 private:
00049     DeclareObjectType;
00050 
00051     FUDaeTextureChannel::Channel textureChannel; // COLLADA 1.3 backward compatibility
00052     FCDImage* image;
00053     string subId;
00054 
00055     // Always preset, this parameter hold the map channel/uv set index
00056     FCDEffectParameterInt* set;
00057 
00058     // Texture color multiplier
00059     float multiplier; // Max-specific
00060 
00061     // Placement parameters. Yes, there's a ton of them [Maya-only]
00062     bool hasProjection3D;
00063     bool hasPlacement2D;
00064     FUDaeBlendMode::Mode blendMode;
00065 
00066     // 2D placement [Maya-only]
00067     float wrapU, wrapV, mirrorU, mirrorV, stagger, fast; // animated, but should really be booleans
00068     float coverageU, coverageV, translateFrameU, translateFrameV, rotateFrame;
00069     float repeatU, repeatV, offsetU, offsetV, rotateUV, noiseU, noiseV;
00070 
00071     // 3D projection [Maya-only]
00072     FMMatrix44 projectionMatrix;
00073     fstring projectionType;
00074 
00075 public:
00079     FCDTexture(FCDocument* document);
00080 
00083     virtual ~FCDTexture();
00084 
00089     virtual Type GetType() const { return TEXTURE; }
00090 
00096     FUDaeTextureChannel::Channel GetTextureChannel() const { return textureChannel; }
00097 
00101     FCDImage* GetImage() { return image; }
00102     const FCDImage* GetImage() const { return image; } 
00106     void SetImage(FCDImage* _image) { image = _image; }
00107 
00111     FCDEffectParameterInt* GetSet() { return set; }
00112     const FCDEffectParameterInt* GetSet() const { return set; } 
00117     FUDaeBlendMode::Mode GetBlendMode() const { return blendMode; }
00118 
00122     void SetBlendMode(FUDaeBlendMode::Mode mode) { blendMode = mode; }
00123 
00126     const string& GetSubId() const { return subId; }
00127 
00130     void SetSubId(const string& _subId) { subId = _subId; }
00131 
00137     float& GetMultiplier() { return multiplier; }
00138     const float& GetMultiplier() const { return multiplier; } 
00144     void SetMultiplier(float _multiplier) { multiplier = _multiplier; }
00145 
00149     bool HasPlacement2D() const { return hasPlacement2D; }
00150 
00152     void ClearPlacement2D();
00153 
00158     float& GetWrapU() { return wrapU; }
00159     const float& GetWrapU() const { return wrapU; } 
00164     void SetWrapU(bool _wrapU) { wrapU = _wrapU ? 1.0f : 0.0f; hasPlacement2D = true; }
00165 
00170     float& GetWrapV() { return wrapV; }
00171     const float& GetWrapV() const { return wrapV; } 
00176     void SetWrapV(bool _wrapV) { wrapV = _wrapV ? 1.0f : 0.0f; hasPlacement2D = true; }
00177 
00182     float& GetMirrorU() { return mirrorU; }
00183     const float& GetMirrorU() const { return mirrorU; } 
00188     void SetMirrorU(bool _mirrorU) { mirrorU = _mirrorU ? 1.0f : 0.0f; hasPlacement2D = true; }
00189 
00194     float& GetMirrorV() { return mirrorV; }
00195     const float& GetMirrorV() const { return mirrorV; } 
00200     void SetMirrorV(bool _mirrorV) { mirrorV = _mirrorV ? 1.0f : 0.0f; hasPlacement2D = true; }
00201 
00206     float& GetStagger() { return stagger; }
00207     const float& GetStagger() const { return stagger; } 
00212     void SetStagger(bool _stagger) { stagger = _stagger ? 1.0f : 0.0f; hasPlacement2D = true; }
00213 
00219     float& GetFast() { return fast; }
00220     const float& GetFast() const { return fast; } 
00226     void SetFast(bool _fast) { fast = _fast ? 1.0f : 0.0f; hasPlacement2D = true; }
00227 
00233     float& GetCoverageU() { return coverageU; }
00234     const float& GetCoverageU() const { return coverageU; } 
00239     void SetCoverageU(float _coverageU) { coverageU = _coverageU; hasPlacement2D = true; }
00240 
00246     float& GetCoverageV() { return coverageV; }
00247     const float& GetCoverageV() const { return coverageV; } 
00252     void SetCoverageV(float _coverageV) { coverageV = _coverageV; hasPlacement2D = true; }
00253 
00259     float& GetTranslateFrameU() { return translateFrameU; }
00260     const float& GetTranslateFrameU() const { return translateFrameU; } 
00266     void SetTranslateFrameU(float _translateFrameU) { translateFrameU = _translateFrameU; hasPlacement2D = true; }
00267 
00273     float& GetTranslateFrameV() { return translateFrameV; }
00274     const float& GetTranslateFrameV() const { return translateFrameV; } 
00280     void SetTranslateFrameV(float _translateFrameV) { translateFrameV = _translateFrameV; hasPlacement2D = true; }
00281 
00287     float& GetRotateFrame() { return rotateFrame; }
00288     const float& GetRotateFrame() const { return rotateFrame; } 
00294     void SetRotateFrame(float _rotateFrame) { rotateFrame = _rotateFrame; hasPlacement2D = true; }
00295 
00299     float& GetRepeatU() { return repeatU; }
00300     const float& GetRepeatU() const { return repeatU; } 
00305     void SetRepeatU(float _repeatU) { repeatU = _repeatU; hasPlacement2D = true; }
00306 
00310     float& GetRepeatV() { return repeatV; }
00311     const float& GetRepeatV() const { return repeatV; } 
00316     void SetRepeatV(float _repeatV) { repeatV = _repeatV; hasPlacement2D = true; }
00317 
00321     float& GetOffsetU() { return offsetU; }
00322     const float& GetOffsetU() const { return offsetU; } 
00327     void SetOffsetU(float _offsetU) { offsetU = _offsetU; hasPlacement2D = true; }
00328 
00332     float& GetOffsetV() { return offsetV; }
00333     const float& GetOffsetV() const { return offsetV; } 
00338     void SetOffsetV(float _offsetV) { offsetV = _offsetV; hasPlacement2D = true; }
00339 
00343     float& GetRotateUV() { return rotateUV; }
00344     const float& GetRotateUV() const { return rotateUV; } 
00349     void SetRotateUV(float _rotateUV) { rotateUV = _rotateUV; hasPlacement2D = true; }
00350 
00354     float& GetNoiseU() { return noiseU; }
00355     const float& GetNoiseU() const { return noiseU; } 
00360     void SetNoiseU(float _noiseU) { noiseU = _noiseU; hasPlacement2D = true; }
00361 
00365     float& GetNoiseV() { return noiseV; }
00366     const float& GetNoiseV() const { return noiseV; } 
00371     void SetNoiseV(float _noiseV) { noiseV = _noiseV; hasPlacement2D = true; }
00372 
00376     bool HasProjection3D() const { return hasProjection3D; }
00377 
00379     void ClearProjection3D();
00380 
00385     FMMatrix44& GetProjectionMatrix() { return projectionMatrix; }
00386     const FMMatrix44& GetProjectionMatrix() const { return projectionMatrix; } 
00392     void SetProjectionMatrix(const FMMatrix44& matrix) { projectionMatrix = matrix; hasProjection3D = true; }
00393     
00397     const fstring& GetProjectionType() const { return projectionType; }
00398 
00402     void SetProjectionType(const fstring& type) { projectionType = type; hasProjection3D = true; } 
00403 
00410     FCDEffectParameter* FindParameterBySemantic(const string& semantic);
00411 
00417     void FindParametersBySemantic(const string& semantic, FCDEffectParameterList& parameters);
00418 
00423     void FindParametersByReference(const string& reference, FCDEffectParameterList& parameters);
00424 
00428     FCDTexture* Clone();
00429 
00434     FUStatus LoadFromTextureXML(xmlNode* textureNode);
00435 
00441     virtual FUStatus LoadFromXML(xmlNode* textureNode);
00442 
00446     virtual xmlNode* WriteToXML(xmlNode* parentNode);
00447 
00448 private:
00449     // Read in the Maya-specific texture placement parameters and look for a texture projection program
00450     FUStatus LoadPlacementXML(xmlNode* techniqueNode);
00451 };
00452 
00453 #endif // _FCD_TEXTURE_H_

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