PixelLightAPI  .
SNLineGrid.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNLineGrid.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_SCENENODE_LINEGRID_H__
00024 #define __PLSCENE_SCENENODE_LINEGRID_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLGraphics/Color/Color4.h>
00032 #include "PLScene/Scene/SceneNode.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLScene {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Line grid scene node on the nodes local space x/y-plane
00047 */
00048 class SNLineGrid : public SceneNode {
00049 
00050 
00051     //[-------------------------------------------------------]
00052     //[ Public definitions                                    ]
00053     //[-------------------------------------------------------]
00054     public:
00055         /**
00056         *  @brief
00057         *    Scene node flags (SceneNode flags extension)
00058         */
00059         enum EFlags {
00060             NoDepthTest  = 1<<10,   /**< Do not perform a depth test */
00061             NoMainLines  = 1<<11,   /**< Do not draw the main lines */
00062             NoMinorLines = 1<<12    /**< Do not draw the minor lines */
00063         };
00064         pl_enum(EFlags)
00065             pl_enum_base(SceneNode::EFlags)
00066             pl_enum_value(NoDepthTest,  "Do not perform a depth test")
00067             pl_enum_value(NoMainLines,  "Do not draw the main lines")
00068             pl_enum_value(NoMinorLines, "Do not draw the minor lines")
00069         pl_enum_end
00070 
00071 
00072     //[-------------------------------------------------------]
00073     //[ RTTI interface                                        ]
00074     //[-------------------------------------------------------]
00075     pl_class(PLS_RTTI_EXPORT, SNLineGrid, "PLScene", PLScene::SceneNode, "Line grid scene node on the nodes local space x/y-plane")
00076         // Attributes
00077         pl_attribute(NumOfXLines,   PLCore::uint32,         5,                                              ReadWrite,  DirectValue,    "Number of lines along each +/- x axis",                                "")
00078         pl_attribute(NumOfYLines,   PLCore::uint32,         5,                                              ReadWrite,  DirectValue,    "Number of lines along each +/- y axis",                                "")
00079         pl_attribute(MainWidth,     float,                  1.0f,                                           ReadWrite,  DirectValue,    "Main lines width (if supported by the the used renderer API)",         "Min='1.0'")
00080         pl_attribute(MainColor,     PLGraphics::Color4,     PLGraphics::Color4(0.1f, 0.1f, 0.1f, 1.0f),     ReadWrite,  DirectValue,    "Main lines color (r/g/b/a)",                                           "")
00081         pl_attribute(MinorWidth,    float,                  1.0f,                                           ReadWrite,  DirectValue,    "Minor lines width (if supported by the the used renderer API)",        "Min='1.0'")
00082         pl_attribute(MinorColor,    PLGraphics::Color4,     PLGraphics::Color4(0.55f, 0.55f, 0.55f, 1.0f),  ReadWrite,  DirectValue,    "Minor lines color (r/g/b/a)",                                          "")
00083             // Overwritten SceneNode attributes
00084         pl_attribute(Flags,         pl_flag_type(EFlags),   0,                                              ReadWrite,  GetSet,         "Flags",                                                                "")
00085         pl_attribute(AABBMin,       PLMath::Vector3,        PLMath::Vector3(-0.5f, -0.5f, -0.5f),           ReadWrite,  GetSet,         "Minimum position of the 'scene node space' axis aligned bounding box", "")
00086         pl_attribute(AABBMax,       PLMath::Vector3,        PLMath::Vector3( 0.5f,  0.5f,  0.5f),           ReadWrite,  GetSet,         "Maximum position of the 'scene node space' axis aligned bounding box", "")
00087         // Constructors
00088         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00089     pl_class_end
00090 
00091 
00092     //[-------------------------------------------------------]
00093     //[ Public functions                                      ]
00094     //[-------------------------------------------------------]
00095     public:
00096         /**
00097         *  @brief
00098         *    Default constructor
00099         */
00100         PLS_API SNLineGrid();
00101 
00102         /**
00103         *  @brief
00104         *    Destructor
00105         */
00106         PLS_API virtual ~SNLineGrid();
00107 
00108 
00109     //[-------------------------------------------------------]
00110     //[ Private functions                                     ]
00111     //[-------------------------------------------------------]
00112     private:
00113         /**
00114         *  @brief
00115         *    Draws the grid
00116         *
00117         *  @param[in] cRenderer
00118         *    Renderer to use
00119         *  @param[in] cVisNode
00120         *    The current visibility node of this scene node
00121         */
00122         void DrawGrid(PLRenderer::Renderer &cRenderer, const VisNode &cVisNode);
00123 
00124 
00125     //[-------------------------------------------------------]
00126     //[ Public virtual SceneNode functions                    ]
00127     //[-------------------------------------------------------]
00128     public:
00129         PLS_API virtual void DrawSolid(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode = nullptr) override;
00130         PLS_API virtual void DrawTransparent(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode = nullptr) override;
00131 
00132 
00133 };
00134 
00135 
00136 //[-------------------------------------------------------]
00137 //[ Namespace                                             ]
00138 //[-------------------------------------------------------]
00139 } // PLScene
00140 
00141 
00142 #endif // __PLSCENE_SCENENODE_LINEGRID_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