Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #ifndef __KX_RAYSENSOR_H 00034 #define __KX_RAYSENSOR_H 00035 00036 #include "SCA_ISensor.h" 00037 #include "MT_Point3.h" 00038 #include "SCA_IScene.h" /* only for scene replace */ 00039 #include "KX_Scene.h" /* only for scene replace */ 00040 00041 struct KX_ClientObjectInfo; 00042 class KX_RayCast; 00043 00044 class KX_RaySensor : public SCA_ISensor 00045 { 00046 Py_Header 00047 STR_String m_propertyname; 00048 bool m_bFindMaterial; 00049 bool m_bXRay; 00050 float m_distance; 00051 class KX_Scene* m_scene; 00052 bool m_bTriggered; 00053 int m_axis; 00054 bool m_rayHit; 00055 float m_hitPosition[3]; 00056 SCA_IObject* m_hitObject; 00057 float m_hitNormal[3]; 00058 float m_rayDirection[3]; 00059 00060 public: 00061 KX_RaySensor(class SCA_EventManager* eventmgr, 00062 SCA_IObject* gameobj, 00063 const STR_String& propname, 00064 bool bFindMaterial, 00065 bool bXRay, 00066 double distance, 00067 int axis, 00068 class KX_Scene* ketsjiScene); 00069 virtual ~KX_RaySensor(); 00070 virtual CValue* GetReplica(); 00071 00072 virtual bool Evaluate(); 00073 virtual bool IsPositiveTrigger(); 00074 virtual void Init(); 00075 00076 bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); 00077 bool NeedRayCast(KX_ClientObjectInfo* client); 00078 00079 virtual void Replace_IScene(SCA_IScene *val) 00080 { 00081 m_scene= static_cast<KX_Scene *>(val); 00082 } 00083 00084 //Python Interface 00085 enum RayAxis { 00086 KX_RAY_AXIS_POS_Y = 0, 00087 KX_RAY_AXIS_POS_X, 00088 KX_RAY_AXIS_POS_Z, 00089 KX_RAY_AXIS_NEG_X, 00090 KX_RAY_AXIS_NEG_Y, 00091 KX_RAY_AXIS_NEG_Z 00092 }; 00093 00094 #ifdef WITH_PYTHON 00095 00096 /* Attributes */ 00097 static PyObject* pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); 00098 00099 #endif // WITH_PYTHON 00100 00101 }; 00102 00103 #endif //__KX_RAYSENSOR_H 00104