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_RANDOMACTUATOR 00034 #define __KX_RANDOMACTUATOR 00035 00036 #include "SCA_IActuator.h" 00037 #include "SCA_RandomNumberGenerator.h" 00038 00039 class SCA_RandomActuator : public SCA_IActuator 00040 { 00041 Py_Header 00043 STR_String m_propname; 00044 00047 float m_parameter1; 00050 float m_parameter2; 00051 00053 SCA_RandomNumberGenerator *m_base; 00054 00056 int m_counter; 00057 00059 long m_previous; 00060 00062 void enforceConstraints(void); 00063 00064 public: 00065 00066 enum KX_RANDOMACT_MODE { 00067 KX_RANDOMACT_NODEF, 00068 KX_RANDOMACT_BOOL_CONST, 00069 KX_RANDOMACT_BOOL_UNIFORM, 00070 KX_RANDOMACT_BOOL_BERNOUILLI, 00071 KX_RANDOMACT_INT_CONST, 00072 KX_RANDOMACT_INT_UNIFORM, 00073 KX_RANDOMACT_INT_POISSON, 00074 KX_RANDOMACT_FLOAT_CONST, 00075 KX_RANDOMACT_FLOAT_UNIFORM, 00076 KX_RANDOMACT_FLOAT_NORMAL, 00077 KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL, 00078 KX_RANDOMACT_MAX 00079 }; 00081 KX_RANDOMACT_MODE m_distribution; 00082 00083 SCA_RandomActuator(class SCA_IObject* gameobj, 00084 long seed, 00085 KX_RANDOMACT_MODE mode, 00086 float para1, 00087 float para2, 00088 const STR_String &propName); 00089 virtual ~SCA_RandomActuator(); 00090 virtual bool Update(); 00091 00092 virtual CValue* GetReplica(); 00093 virtual void ProcessReplica(); 00094 00095 #ifdef WITH_PYTHON 00096 00097 /* --------------------------------------------------------------------- */ 00098 /* Python interface ---------------------------------------------------- */ 00099 /* --------------------------------------------------------------------- */ 00100 00101 static PyObject* pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); 00102 static int pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); 00103 00104 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolConst); 00105 KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator, setBoolUniform); 00106 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli); 00107 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntConst); 00108 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntUniform); 00109 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntPoisson); 00110 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatConst); 00111 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatUniform); 00112 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNormal); 00113 KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential); 00114 00115 #endif // WITH_PYTHON 00116 00117 }; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */ 00118 00119 #endif 00120