PixelLightAPI  .
SNMPhysicsForce.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMPhysicsForce.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 __PLPHYSICS_SCENENODEMODIFIERS_FORCE_H__
00024 #define __PLPHYSICS_SCENENODEMODIFIERS_FORCE_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Event/EventHandler.h>
00032 #include <PLMath/Vector3.h>
00033 #include "PLPhysics/SceneNodeModifiers/SNMPhysics.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLPhysics {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Classes                                               ]
00044 //[-------------------------------------------------------]
00045 /**
00046 *  @brief
00047 *    Physics scene node modifier adding a force to the first found physics body of the owner scene node
00048 */
00049 class SNMPhysicsForce : public SNMPhysics {
00050 
00051 
00052     //[-------------------------------------------------------]
00053     //[ RTTI interface                                        ]
00054     //[-------------------------------------------------------]
00055     pl_class(PLPHYSICS_RTTI_EXPORT, SNMPhysicsForce, "PLPhysics", PLPhysics::SNMPhysics, "Physics scene node modifier adding a force to the first found physics body of the owner scene node")
00056         // Attributes
00057         pl_attribute(Force, PLMath::Vector3,    PLMath::Vector3::Zero,  ReadWrite,  DirectValue,    "Force to add", "")
00058         // Constructors
00059         pl_constructor_1(ParameterConstructor,  PLScene::SceneNode&,    "Parameter constructor",    "")
00060     pl_class_end
00061 
00062 
00063     //[-------------------------------------------------------]
00064     //[ Public functions                                      ]
00065     //[-------------------------------------------------------]
00066     public:
00067         /**
00068         *  @brief
00069         *    Constructor
00070         *
00071         *  @param[in] cSceneNode
00072         *    Owner scene node
00073         */
00074         PLPHYSICS_API SNMPhysicsForce(PLScene::SceneNode &cSceneNode);
00075 
00076         /**
00077         *  @brief
00078         *    Destructor
00079         */
00080         PLPHYSICS_API virtual ~SNMPhysicsForce();
00081 
00082 
00083     //[-------------------------------------------------------]
00084     //[ Protected virtual PLScene::SceneNodeModifier functions ]
00085     //[-------------------------------------------------------]
00086     protected:
00087         PLPHYSICS_API virtual void OnActivate(bool bActivate) override;
00088 
00089 
00090     //[-------------------------------------------------------]
00091     //[ Private functions                                     ]
00092     //[-------------------------------------------------------]
00093     private:
00094         /**
00095         *  @brief
00096         *    Called when the scene node modifier needs to be updated
00097         */
00098         void OnUpdate();
00099 
00100 
00101     //[-------------------------------------------------------]
00102     //[ Private event handlers                                ]
00103     //[-------------------------------------------------------]
00104     private:
00105         PLCore::EventHandler<> EventHandlerUpdate;
00106 
00107 
00108 };
00109 
00110 
00111 //[-------------------------------------------------------]
00112 //[ Namespace                                             ]
00113 //[-------------------------------------------------------]
00114 } // PLPhysics
00115 
00116 
00117 #endif // __PLPHYSICS_SCENENODEMODIFIERS_FORCE_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