brushmask.h

Go to the documentation of this file.
00001 
00002 //**************************************************************************/
00003 // Copyright (c) 2008 Autodesk, Inc.
00004 // All rights reserved.
00005 //
00006 // Use of this software is subject to the terms of the Autodesk license
00007 // agreement provided at the time of installation or download, or which
00008 // otherwise accompanies this software in either electronic or hard copy form.
00009 //
00010 //**************************************************************************/
00011 // DESCRIPTION:
00012 // CREATED: November 2009
00013 //**************************************************************************/
00014 
00015 #ifndef __MUDBOXSDK_BRUSHMASK_H__
00016 #define __MUDBOXSDK_BRUSHMASK_H__
00017 
00018 namespace mudbox {
00019 
00021 struct MBDLL_DECL BrushMask : public TreeNode
00022 {
00023     Q_DECLARE_TR_FUNCTIONS(mudbox::BrushMask)
00024     DECLARE_CLASS;
00025 
00027     BrushMask( void );
00029     ~BrushMask( void );
00030 
00032     void SetState( bool b );
00034     bool State( void );
00035 
00037     float Factor( void );
00039     void SetFactor( float f );
00040 
00042     virtual void SetTransformation( const Matrix &mTransformation );
00044     Matrix Transformation( void );
00045 
00047     virtual class Image *Image( void );
00048 
00050     void SetImage( class Image *pImage );
00052     void Clear( void );
00056     void SetFileName( const QString &sFileName );
00058     virtual void CreateTextures( void );
00059     QString GetFileName() const { return m_sFileName; }
00060 
00061 
00062 protected:
00063     Matrix        m_mTransformation;
00064     float         m_fAspectRatio;
00065 
00066     class Image  *m_pImage;
00067     Texture      *m_pLuminanceTexture;
00068 
00069     abool         m_bState;
00070     afloatr       m_fFactor;
00071     astring       m_sFileName;
00072 };
00073 
00075 struct MBDLL_DECL BrushStamp : public BrushMask
00076 {
00077     DECLARE_CLASS;
00078 
00080     void SetParameters( const StampConfiguration  &config, 
00081                         const Vector              &vPosition, 
00082                         const Vector              &vNormal, 
00083                         float                     fSize, 
00084                         const Matrix             &mLocalToWorld );
00085 
00088     void CalculateTransformation( const Vector &vPosition, 
00089                                   const Vector &vNormal, 
00090                                   const Vector &vUp, 
00091                                   float fScaleX, float fScaleY, 
00092                                   bool  bFlip,   bool  bFlop, 
00093                                   const Matrix &mLocalToWorld );
00094 };
00095 
00097 struct MBDLL_DECL BrushStencil : public BrushMask
00098 {
00099     enum
00100     {
00101         eColorModeUndefined = -1,
00102         eColorModeLuminance,
00103         eColorModeColored
00104     };
00105 
00106     DECLARE_CLASS;
00107 
00109     BrushStencil( void );
00111     ~BrushStencil( void );
00112 
00114     void SetVisibility( float f );
00116     float Visibility( void );
00117 
00119     void SetUIEnabled( bool b );
00120 
00122     void SetColorMode( unsigned int mode );
00124     unsigned int ColorMode( void );
00125 
00127     void SetTransformation( const Matrix &mTransformation );
00129     void UpdateMatrix( void );
00131     const Matrix &Final( void ) const;
00133     Matrix MirroredFinal( void ) const;
00134 
00136     bool IsMirrored( void ) const;
00137 
00139     void SetInverted(bool inv) { m_bInvert.SetValue(inv); }
00140 
00142     bool IsInverted( void ) const;
00143 
00145     bool Activate( void );
00147     bool Deactivate( void );
00148 
00150     void SetFromImage( class Image *pSrcImage );
00151 
00153     virtual void CreateTextures( void );
00154 
00155     Texture *getTexture() const { return m_pColorTexture; }
00156 
00163     void SetFromColorTexture(Texture *pSrcTexture);
00164 
00165 protected:
00166     bool          m_bUIEnabled;
00167     unsigned int  m_iColorMode;
00168     Matrix        m_mProjector;
00169     Matrix        m_mFinal;
00170 
00171     Texture      *m_pColorTexture;
00172 
00173     // attributes
00174     afloatr       m_fVisibility;
00175     abool         m_bInvert;
00176     abool         m_bUseTiles; 
00177     abool         m_bShowTiles;
00178     afloatr       m_fOffset;
00179     abool         m_bAutoHide;
00180     abool         m_bMirror;
00181     abool         m_bFlipX;
00182     abool         m_bFlipY;
00183                  
00184     aevent        m_cImport;
00185     aevent        m_cExport;
00186 };
00187 
00188 }; // end of namespace mudbox
00189 
00190 #endif