PixelLightAPI  .
SNBitmap.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNBitmap.h                                     *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLSCENE_SCENENODE_BITMAP_H__
00024 #define __PLSCENE_SCENENODE_BITMAP_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLMath/Vector2.h>
00032 #include <PLGraphics/Color/Color4.h>
00033 #include <PLRenderer/Material/MaterialHandler.h>
00034 #include "PLScene/Scene/SceneNode.h"
00035 
00036 
00037 //[-------------------------------------------------------]
00038 //[ Namespace                                             ]
00039 //[-------------------------------------------------------]
00040 namespace PLScene {
00041 
00042 
00043 //[-------------------------------------------------------]
00044 //[ Classes                                               ]
00045 //[-------------------------------------------------------]
00046 /**
00047 *  @brief
00048 *    Abstract bitmap scene node
00049 *
00050 *  @remarks
00051 *    If 'Material' is not a material or an effect, the effect of the default value of
00052 *    'Material' is used together with the given texture.
00053 */
00054 class SNBitmap : public SceneNode {
00055 
00056 
00057     //[-------------------------------------------------------]
00058     //[ Public definitions                                    ]
00059     //[-------------------------------------------------------]
00060     public:
00061         /**
00062         *  @brief
00063         *    Scene node flags (SceneNode flags extension)
00064         */
00065         enum EFlags {
00066             IgnoreColor = 1<<10 /**< Ignore the color variable of the bitmap */
00067         };
00068         pl_enum(EFlags)
00069             pl_enum_base(SceneNode::EFlags)
00070             pl_enum_value(IgnoreColor, "Ignore the color variable of the bitmap")
00071         pl_enum_end
00072 
00073 
00074     //[-------------------------------------------------------]
00075     //[ RTTI interface                                        ]
00076     //[-------------------------------------------------------]
00077     pl_class(PLS_RTTI_EXPORT, SNBitmap, "PLScene", PLScene::SceneNode, "Abstract bitmap scene node")
00078         // Attributes
00079         pl_attribute(Material,      PLCore::String,         "Data/Effects/DefaultBitmap.plfx",  ReadWrite,  GetSet, "Material to use",                                          "Type='Material Effect Image TextureAni'")
00080         pl_attribute(Color,         PLGraphics::Color4,     PLGraphics::Color4::White,          ReadWrite,  GetSet, "Bitmap color",                                             "")
00081         pl_attribute(TexelStart,    PLMath::Vector2,        PLMath::Vector2::Zero,              ReadWrite,  GetSet, "Bitmap texture source rectangle (0..1) start coordinate",  "")
00082         pl_attribute(TexelEnd,      PLMath::Vector2,        PLMath::Vector2::One,               ReadWrite,  GetSet, "Bitmap texture source rectangle (0..1) end coordinate",    "")
00083             // Overwritten SceneNode attributes
00084         pl_attribute(Flags,         pl_flag_type(EFlags),   0,                                  ReadWrite,  GetSet, "Flags",                                                    "")
00085     pl_class_end
00086 
00087 
00088     //[-------------------------------------------------------]
00089     //[ Public RTTI get/set functions                         ]
00090     //[-------------------------------------------------------]
00091     public:
00092         PLS_API PLCore::String GetMaterial() const;
00093         PLS_API void SetMaterial(const PLCore::String &sValue);
00094         PLS_API virtual const PLGraphics::Color4 &GetColor() const;
00095         PLS_API virtual void SetColor(const PLGraphics::Color4 &cValue);
00096         PLS_API virtual const PLMath::Vector2 &GetTexelStart() const;
00097         PLS_API virtual void SetTexelStart(const PLMath::Vector2 &vValue);
00098         PLS_API virtual const PLMath::Vector2 &GetTexelEnd() const;
00099         PLS_API virtual void SetTexelEnd(const PLMath::Vector2 &vValue);
00100 
00101 
00102     //[-------------------------------------------------------]
00103     //[ Public functions                                      ]
00104     //[-------------------------------------------------------]
00105     public:
00106         /**
00107         *  @brief
00108         *    Returns the handler of the material
00109         *
00110         *  @return
00111         *    Handler of the material
00112         */
00113         PLS_API const PLRenderer::MaterialHandler &GetMaterialHandler();
00114 
00115 
00116     //[-------------------------------------------------------]
00117     //[ Protected functions                                   ]
00118     //[-------------------------------------------------------]
00119     protected:
00120         /**
00121         *  @brief
00122         *    Default constructor
00123         */
00124         PLS_API SNBitmap();
00125 
00126         /**
00127         *  @brief
00128         *    Destructor
00129         */
00130         PLS_API virtual ~SNBitmap();
00131 
00132 
00133     //[-------------------------------------------------------]
00134     //[ Private data                                          ]
00135     //[-------------------------------------------------------]
00136     private:
00137         PLCore::String              m_sMaterial;    /**< Material */
00138         bool                        m_bMaterial;    /**< Material loaded? */
00139         PLRenderer::MaterialHandler m_cMaterial;    /**< Material */
00140         PLGraphics::Color4          m_cColor;       /**< Bitmap color */
00141         PLMath::Vector2             m_vTexelStart;  /**< Bitmap texture source rectangle (0..1) start coordinate */
00142         PLMath::Vector2             m_vTexelEnd;    /**< Bitmap texture source rectangle (0..1) end coordinate */
00143 
00144 
00145 };
00146 
00147 
00148 //[-------------------------------------------------------]
00149 //[ Namespace                                             ]
00150 //[-------------------------------------------------------]
00151 } // PLScene
00152 
00153 
00154 #endif // __PLSCENE_SCENENODE_BITMAP_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:00
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported