PixelLightAPI  .
SNLine.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNLine.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_LINE_H__
00024 #define __PLSCENE_SCENENODE_LINE_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 scene node
00047 */
00048 class SNLine : 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             No3DPosition = 1<<10,   /**< The line is not placed within 3D. If this flag is set, the node position is in 'screen space' between 0.0 and 1.0. */
00061             NoDepthTest  = 1<<11    /**< Do not perform a depth test */
00062         };
00063         pl_enum(EFlags)
00064             pl_enum_base(SceneNode::EFlags)
00065             pl_enum_value(No3DPosition, "The line is not placed within 3D. If this flag is set, the node position is in 'screen space' between 0.0 and 1.0.")
00066             pl_enum_value(NoDepthTest,  "Do not perform a depth test")
00067         pl_enum_end
00068 
00069 
00070     //[-------------------------------------------------------]
00071     //[ RTTI interface                                        ]
00072     //[-------------------------------------------------------]
00073     pl_class(PLS_RTTI_EXPORT, SNLine, "PLScene", PLScene::SceneNode, "Line scene node")
00074         // Constructors
00075         pl_constructor_0(DefaultConstructor, "Default constructor", "")
00076         // Attributes
00077         pl_attribute(StartPosition, PLMath::Vector3,        PLMath::Vector3::Zero,      ReadWrite,  GetSet,         "Line start position (relative to this node)",              "")
00078         pl_attribute(EndPosition,   PLMath::Vector3,        PLMath::Vector3::UnitZ,     ReadWrite,  GetSet,         "Line end position (relative to this node)",                "")
00079         pl_attribute(Width,         float,                  1.0f,                       ReadWrite,  DirectValue,    "Line width (if supported by the the used renderer API)",   "Min='1.0'")
00080         pl_attribute(Color,         PLGraphics::Color4,     PLGraphics::Color4::White,  ReadWrite,  DirectValue,    "Line color (r/g/b/a)",                                     "")
00081             // Overwritten SceneNode attributes
00082         pl_attribute(Flags,         pl_flag_type(EFlags),   0,                          ReadWrite,  GetSet,         "Flags",                                                    "")
00083     pl_class_end
00084 
00085 
00086     //[-------------------------------------------------------]
00087     //[ Public RTTI get/set functions                         ]
00088     //[-------------------------------------------------------]
00089     public:
00090         PLS_API const PLMath::Vector3 &GetStartPosition() const;
00091         PLS_API void SetStartPosition(const PLMath::Vector3 &vValue);
00092         PLS_API const PLMath::Vector3 &GetEndPosition() const;
00093         PLS_API void SetEndPosition(const PLMath::Vector3 &vValue);
00094 
00095 
00096     //[-------------------------------------------------------]
00097     //[ Public functions                                      ]
00098     //[-------------------------------------------------------]
00099     public:
00100         /**
00101         *  @brief
00102         *    Default constructor
00103         */
00104         PLS_API SNLine();
00105 
00106         /**
00107         *  @brief
00108         *    Destructor
00109         */
00110         PLS_API virtual ~SNLine();
00111 
00112 
00113     //[-------------------------------------------------------]
00114     //[ Private data                                          ]
00115     //[-------------------------------------------------------]
00116     private:
00117         PLMath::Vector3 m_vStartPosition;   /**< Line start position (relative to this node) */
00118         PLMath::Vector3 m_vEndPosition;     /**< Line end position (relative to this node) */
00119 
00120 
00121     //[-------------------------------------------------------]
00122     //[ Public virtual SceneNode functions                    ]
00123     //[-------------------------------------------------------]
00124     public:
00125         PLS_API virtual void DrawSolid(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode = nullptr) override;
00126         PLS_API virtual void DrawTransparent(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode = nullptr) override;
00127 
00128 
00129     //[-------------------------------------------------------]
00130     //[ Protected virtual SceneNode functions                 ]
00131     //[-------------------------------------------------------]
00132     protected:
00133         PLS_API virtual void UpdateAABoundingBox() override;
00134 
00135 
00136 };
00137 
00138 
00139 //[-------------------------------------------------------]
00140 //[ Namespace                                             ]
00141 //[-------------------------------------------------------]
00142 } // PLScene
00143 
00144 
00145 #endif // __PLSCENE_SCENENODE_LINE_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