PixelLightAPI  .
SNMDrawRectangle.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMDrawRectangle.h                             *
00003  *
00004  *  Copyright (C) 2002-2011 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_SCENENODEMODIFIER_DRAWRECTANGLE_H__
00024 #define __PLSCENE_SCENENODEMODIFIER_DRAWRECTANGLE_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLGraphics/Color/Color4.h>
00032 #include "PLScene/Scene/SceneNodeModifiers/SNMDraw.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Forward declarations                                  ]
00037 //[-------------------------------------------------------]
00038 namespace PLRenderer {
00039     class Renderer;
00040 }
00041 namespace PLScene {
00042     class VisNode;
00043 }
00044 
00045 
00046 //[-------------------------------------------------------]
00047 //[ Namespace                                             ]
00048 //[-------------------------------------------------------]
00049 namespace PLScene {
00050 
00051 
00052 //[-------------------------------------------------------]
00053 //[ Classes                                               ]
00054 //[-------------------------------------------------------]
00055 /**
00056 *  @brief
00057 *    Scene node modifier class drawing a 2D rectangle around the owner scene node
00058 */
00059 class SNMDrawRectangle : public SNMDraw {
00060 
00061 
00062     //[-------------------------------------------------------]
00063     //[ Public definition                                     ]
00064     //[-------------------------------------------------------]
00065     public:
00066         /**
00067         *  @brief
00068         *    Scene node modifier flags (SceneNodeModifier flags extension)
00069         */
00070         enum EFlags {
00071             DepthTest = 1<<2    /**< Perform a depth test */
00072         };
00073         pl_enum(EFlags)
00074             pl_enum_base(SNMDraw::EFlags)
00075             pl_enum_value(DepthTest, "Perform a depth test")
00076         pl_enum_end
00077 
00078 
00079     //[-------------------------------------------------------]
00080     //[ RTTI interface                                        ]
00081     //[-------------------------------------------------------]
00082     pl_class(PLS_RTTI_EXPORT, SNMDrawRectangle, "PLScene", PLScene::SNMDraw, "Scene node modifier class drawing a 2D rectangle around the owner scene node")
00083         // Attributes
00084         pl_attribute(Width, float,                  1.0f,                                       ReadWrite,  DirectValue,    "Rectangle width (if supported by the the used renderer API, if not may have no effect)",   "Min='1.0'")
00085         pl_attribute(Color, PLGraphics::Color4,     PLGraphics::Color4(1.0f, 1.0f, 1.0f, 1.0f), ReadWrite,  DirectValue,    "Rectangle color (r/g/b/a)",                                                                "")
00086             // Overwritten SceneNodeModifier attributes
00087         pl_attribute(Flags, pl_flag_type(EFlags),   0,                                          ReadWrite,  GetSet,         "Flags",                                                                                    "")
00088         // Constructors
00089         pl_constructor_1(ParameterConstructor,  SceneNode&, "Parameter constructor",    "")
00090         // Slots
00091         pl_slot_2(OnDrawTransparent,    PLRenderer::Renderer&,  const VisNode*, "Called on scene node transparent draw, the used renderer as first parameter, the current visibility node of this scene node, can be a null pointer as second parameter",   "")
00092     pl_class_end
00093 
00094 
00095     //[-------------------------------------------------------]
00096     //[ Public functions                                      ]
00097     //[-------------------------------------------------------]
00098     public:
00099         /**
00100         *  @brief
00101         *    Constructor
00102         *
00103         *  @param[in] cSceneNode
00104         *    Owner scene node
00105         */
00106         PLS_API SNMDrawRectangle(SceneNode &cSceneNode);
00107 
00108         /**
00109         *  @brief
00110         *    Destructor
00111         */
00112         PLS_API virtual ~SNMDrawRectangle();
00113 
00114 
00115     //[-------------------------------------------------------]
00116     //[ Protected virtual SceneNodeModifier functions         ]
00117     //[-------------------------------------------------------]
00118     protected:
00119         PLS_API virtual void OnActivate(bool bActivate) override;
00120 
00121 
00122     //[-------------------------------------------------------]
00123     //[ Private functions                                     ]
00124     //[-------------------------------------------------------]
00125     private:
00126         /**
00127         *  @brief
00128         *    Called on scene node transparent draw
00129         *
00130         *  @param[in] cRenderer
00131         *    The used renderer
00132         *  @param[in] pVisNode
00133         *    The current visibility node of this scene node, can be a null pointer
00134         */
00135         void OnDrawTransparent(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode);
00136 
00137 
00138 };
00139 
00140 
00141 //[-------------------------------------------------------]
00142 //[ Namespace                                             ]
00143 //[-------------------------------------------------------]
00144 } // PLScene
00145 
00146 
00147 #endif // __PLSCENE_SCENENODEMODIFIER_DRAWRECTANGLE_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:02
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported