PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNArea.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_AREA_H__ 00024 #define __PLSCENE_SCENENODE_AREA_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLMath/PlaneSet.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 * An area is a set of planes defining a convex area in your scene 00047 * 00048 * @note 00049 * - Don't scale an area, this will produce some problems... 00050 */ 00051 class SNArea : public SceneNode, public PLMath::PlaneSet { 00052 00053 00054 //[-------------------------------------------------------] 00055 //[ RTTI interface ] 00056 //[-------------------------------------------------------] 00057 pl_class(PLS_RTTI_EXPORT, SNArea, "PLScene", PLScene::SceneNode, "An area is a set of planes defining a convex area in your scene") 00058 // Properties 00059 pl_properties 00060 pl_property("Icon", "Data/Textures/IconArea.dds") 00061 pl_properties_end 00062 // Attributes 00063 pl_attribute(Box, PLCore::String, "-0.5 -0.5 -0.5 0.5 0.5 0.5", ReadWrite, GetSet, "Box min/max position (creates automatically the required planes)", "") 00064 pl_attribute(Planes, PLCore::String, "", ReadWrite, GetSet, "Planes defining the (normally convex) area", "") 00065 // Constructors 00066 pl_constructor_0(DefaultConstructor, "Default constructor", "") 00067 pl_class_end 00068 00069 00070 //[-------------------------------------------------------] 00071 //[ Public RTTI get/set functions ] 00072 //[-------------------------------------------------------] 00073 public: 00074 PLS_API PLCore::String GetBox() const; 00075 PLS_API void SetBox(const PLCore::String &sValue); 00076 PLS_API PLCore::String GetPlanes() const; 00077 PLS_API void SetPlanes(const PLCore::String &sValue); 00078 00079 00080 //[-------------------------------------------------------] 00081 //[ Public functions ] 00082 //[-------------------------------------------------------] 00083 public: 00084 /** 00085 * @brief 00086 * Default constructor 00087 */ 00088 PLS_API SNArea(); 00089 00090 /** 00091 * @brief 00092 * Destructor 00093 */ 00094 PLS_API virtual ~SNArea(); 00095 00096 /** 00097 * @brief 00098 * Draws the area 00099 */ 00100 PLS_API void Draw(); 00101 00102 00103 //[-------------------------------------------------------] 00104 //[ Private functions ] 00105 //[-------------------------------------------------------] 00106 private: 00107 /** 00108 * @brief 00109 * Check if an box should be created 00110 */ 00111 void CheckBox(); 00112 00113 /** 00114 * @brief 00115 * Check if planes should be added to the area 00116 */ 00117 void CheckPlanes(); 00118 00119 00120 //[-------------------------------------------------------] 00121 //[ Private data ] 00122 //[-------------------------------------------------------] 00123 private: 00124 PLCore::String m_sBox; /**< Box min/max position (creates automatically the required planes) */ 00125 PLCore::String m_sPlanes; /**< Planes defining the (normally convex) area */ 00126 00127 00128 //[-------------------------------------------------------] 00129 //[ Protected virtual SceneNode functions ] 00130 //[-------------------------------------------------------] 00131 protected: 00132 PLS_API virtual void InitFunction() override; 00133 00134 00135 }; 00136 00137 00138 //[-------------------------------------------------------] 00139 //[ Namespace ] 00140 //[-------------------------------------------------------] 00141 } // PLScene 00142 00143 00144 #endif // __PLSCENE_SCENENODE_AREA_H__
|