quiet double promotion warnings for the game engine.
This commit is contained in:
@@ -82,10 +82,6 @@ extern "C" {
|
|||||||
/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */
|
/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */
|
||||||
extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
|
extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
|
||||||
|
|
||||||
|
|
||||||
//XXX #include "BIF_screen.h"
|
|
||||||
//XXX #include "BIF_scrarea.h"
|
|
||||||
|
|
||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLO_readfile.h"
|
#include "BLO_readfile.h"
|
||||||
@@ -93,7 +89,6 @@ extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
|
|||||||
#include "BKE_ipo.h"
|
#include "BKE_ipo.h"
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
//XXX #include "BSE_headerbuttons.h"
|
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
#include "../../blender/windowmanager/WM_types.h"
|
#include "../../blender/windowmanager/WM_types.h"
|
||||||
#include "../../blender/windowmanager/wm_window.h"
|
#include "../../blender/windowmanager/wm_window.h"
|
||||||
|
@@ -383,8 +383,7 @@ void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
|
|||||||
glAccum(GL_LOAD, 1.0);
|
glAccum(GL_LOAD, 1.0);
|
||||||
rasterizer->SetMotionBlurState(2);
|
rasterizer->SetMotionBlurState(2);
|
||||||
}
|
}
|
||||||
else if (motionblurvalue>=0.0 && motionblurvalue<=1.0)
|
else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) {
|
||||||
{
|
|
||||||
glAccum(GL_MULT, motionblurvalue);
|
glAccum(GL_MULT, motionblurvalue);
|
||||||
glAccum(GL_ACCUM, 1-motionblurvalue);
|
glAccum(GL_ACCUM, 1-motionblurvalue);
|
||||||
glAccum(GL_RETURN, 1.0);
|
glAccum(GL_RETURN, 1.0);
|
||||||
|
@@ -258,7 +258,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
|
|||||||
joints[2] = -joint_mat[1][0];
|
joints[2] = -joint_mat[1][0];
|
||||||
norm = normalize_v3(joints);
|
norm = normalize_v3(joints);
|
||||||
if (norm < FLT_EPSILON) {
|
if (norm < FLT_EPSILON) {
|
||||||
norm = (joint_mat[1][1] < 0.f) ? M_PI : 0.f;
|
norm = (joint_mat[1][1] < 0.0f) ? (float)M_PI : 0.0f;
|
||||||
} else {
|
} else {
|
||||||
norm = acos(joint_mat[1][1]);
|
norm = acos(joint_mat[1][1]);
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
|
|||||||
joints[2] = (joint_mat[0][1]-joint_mat[1][0])*0.5f;
|
joints[2] = (joint_mat[0][1]-joint_mat[1][0])*0.5f;
|
||||||
sa = len_v3(joints);
|
sa = len_v3(joints);
|
||||||
ca = (joint_mat[0][0]+joint_mat[1][1]+joint_mat[1][1]-1.0f)*0.5f;
|
ca = (joint_mat[0][0]+joint_mat[1][1]+joint_mat[1][1]-1.0f)*0.5f;
|
||||||
if (sa > FLT_EPSILON) {
|
if (sa > (double)FLT_EPSILON) {
|
||||||
norm = atan2(sa,ca)/sa;
|
norm = atan2(sa,ca)/sa;
|
||||||
} else {
|
} else {
|
||||||
if (ca < 0.0) {
|
if (ca < 0.0) {
|
||||||
|
@@ -334,7 +334,7 @@ PyObject* BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_P
|
|||||||
}
|
}
|
||||||
switch (attr_order) {
|
switch (attr_order) {
|
||||||
case BCA_IKWEIGHT:
|
case BCA_IKWEIGHT:
|
||||||
return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight:0.0);
|
return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight : 0.0f);
|
||||||
case BCA_IKTYPE:
|
case BCA_IKTYPE:
|
||||||
return PyLong_FromLong(ikconstraint->type);
|
return PyLong_FromLong(ikconstraint->type);
|
||||||
case BCA_IKFLAG:
|
case BCA_IKFLAG:
|
||||||
@@ -370,7 +370,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
|
|||||||
switch (attr_order) {
|
switch (attr_order) {
|
||||||
case BCA_ENFORCE:
|
case BCA_ENFORCE:
|
||||||
dval = PyFloat_AsDouble(value);
|
dval = PyFloat_AsDouble(value);
|
||||||
if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */
|
if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */
|
||||||
PyErr_SetString(PyExc_AttributeError, "constraint.enforce = float: BL_ArmatureConstraint, expected a float between 0 and 1");
|
PyErr_SetString(PyExc_AttributeError, "constraint.enforce = float: BL_ArmatureConstraint, expected a float between 0 and 1");
|
||||||
return PY_SET_ATTR_FAIL;
|
return PY_SET_ATTR_FAIL;
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
|
|||||||
|
|
||||||
case BCA_HEADTAIL:
|
case BCA_HEADTAIL:
|
||||||
dval = PyFloat_AsDouble(value);
|
dval = PyFloat_AsDouble(value);
|
||||||
if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */
|
if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */
|
||||||
PyErr_SetString(PyExc_AttributeError, "constraint.headtail = float: BL_ArmatureConstraint, expected a float between 0 and 1");
|
PyErr_SetString(PyExc_AttributeError, "constraint.headtail = float: BL_ArmatureConstraint, expected a float between 0 and 1");
|
||||||
return PY_SET_ATTR_FAIL;
|
return PY_SET_ATTR_FAIL;
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
|
|||||||
switch (attr_order) {
|
switch (attr_order) {
|
||||||
case BCA_IKWEIGHT:
|
case BCA_IKWEIGHT:
|
||||||
dval = PyFloat_AsDouble(value);
|
dval = PyFloat_AsDouble(value);
|
||||||
if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */
|
if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */
|
||||||
PyErr_SetString(PyExc_AttributeError, "constraint.weight = float: BL_ArmatureConstraint, expected a float between 0 and 1");
|
PyErr_SetString(PyExc_AttributeError, "constraint.weight = float: BL_ArmatureConstraint, expected a float between 0 and 1");
|
||||||
return PY_SET_ATTR_FAIL;
|
return PY_SET_ATTR_FAIL;
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
|
|||||||
|
|
||||||
case BCA_IKDIST:
|
case BCA_IKDIST:
|
||||||
dval = PyFloat_AsDouble(value);
|
dval = PyFloat_AsDouble(value);
|
||||||
if (dval < 0.0f) { /* also accounts for non float */
|
if (dval < 0.0) { /* also accounts for non float */
|
||||||
PyErr_SetString(PyExc_AttributeError, "constraint.ik_dist = float: BL_ArmatureConstraint, expected a positive float");
|
PyErr_SetString(PyExc_AttributeError, "constraint.ik_dist = float: BL_ArmatureConstraint, expected a positive float");
|
||||||
return PY_SET_ATTR_FAIL;
|
return PY_SET_ATTR_FAIL;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
* \ingroup bgeconv
|
* \ingroup bgeconv
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
||||||
#pragma warning (disable : 4786)
|
#pragma warning (disable : 4786)
|
||||||
#endif
|
#endif
|
||||||
@@ -186,10 +185,8 @@ extern Material defmaterial; /* material.c */
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
//XXX #include "BSE_headerbuttons.h"
|
|
||||||
//XXX void update_for_newframe();
|
//XXX void update_for_newframe();
|
||||||
//void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay);
|
//void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay);
|
||||||
//#include "BKE_ipo.h"
|
|
||||||
//void do_all_data_ipos(void);
|
//void do_all_data_ipos(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@@ -464,10 +461,10 @@ static void GetRGB(short type,
|
|||||||
unsigned char cp[4];
|
unsigned char cp[4];
|
||||||
unsigned int integer;
|
unsigned int integer;
|
||||||
} col_converter;
|
} col_converter;
|
||||||
col_converter.cp[3] = (unsigned char) (mat->r*255.0);
|
col_converter.cp[3] = (unsigned char) (mat->r * 255.0f);
|
||||||
col_converter.cp[2] = (unsigned char) (mat->g*255.0);
|
col_converter.cp[2] = (unsigned char) (mat->g * 255.0f);
|
||||||
col_converter.cp[1] = (unsigned char) (mat->b*255.0);
|
col_converter.cp[1] = (unsigned char) (mat->b * 255.0f);
|
||||||
col_converter.cp[0] = (unsigned char) (mat->alpha*255.0);
|
col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
|
||||||
color = col_converter.integer;
|
color = col_converter.integer;
|
||||||
}
|
}
|
||||||
c0 = KX_rgbaint2uint_new(color);
|
c0 = KX_rgbaint2uint_new(color);
|
||||||
@@ -1143,10 +1140,10 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
|
|||||||
unsigned int integer;
|
unsigned int integer;
|
||||||
} col_converter;
|
} col_converter;
|
||||||
|
|
||||||
col_converter.cp[3] = (unsigned char) (ma->r*255.0);
|
col_converter.cp[3] = (unsigned char) (ma->r * 255.0f);
|
||||||
col_converter.cp[2] = (unsigned char) (ma->g*255.0);
|
col_converter.cp[2] = (unsigned char) (ma->g * 255.0f);
|
||||||
col_converter.cp[1] = (unsigned char) (ma->b*255.0);
|
col_converter.cp[1] = (unsigned char) (ma->b * 255.0f);
|
||||||
col_converter.cp[0] = (unsigned char) (ma->alpha*255.0);
|
col_converter.cp[0] = (unsigned char) (ma->alpha * 255.0f);
|
||||||
|
|
||||||
color = col_converter.integer;
|
color = col_converter.integer;
|
||||||
}
|
}
|
||||||
@@ -1330,8 +1327,8 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero
|
|||||||
MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f);
|
MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f);
|
||||||
MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f);
|
MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f);
|
||||||
|
|
||||||
shapeProps->m_lin_drag = 1.0 - blenderobject->damping;
|
shapeProps->m_lin_drag = 1.0f - blenderobject->damping;
|
||||||
shapeProps->m_ang_drag = 1.0 - blenderobject->rdamping;
|
shapeProps->m_ang_drag = 1.0f - blenderobject->rdamping;
|
||||||
|
|
||||||
shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0];
|
shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0];
|
||||||
shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1];
|
shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1];
|
||||||
@@ -1456,17 +1453,17 @@ static void my_tex_space_mesh(Mesh *me)
|
|||||||
copy_v3_v3(me->size, size);
|
copy_v3_v3(me->size, size);
|
||||||
me->rot[0]= me->rot[1]= me->rot[2]= 0.0f;
|
me->rot[0]= me->rot[1]= me->rot[2]= 0.0f;
|
||||||
|
|
||||||
if (me->size[0]==0.0) me->size[0]= 1.0f;
|
if (me->size[0] == 0.0f) me->size[0] = 1.0f;
|
||||||
else if (me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
|
else if (me->size[0] > 0.0f && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
|
||||||
else if (me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
|
else if (me->size[0] < 0.0f && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
|
||||||
|
|
||||||
if (me->size[1]==0.0) me->size[1]= 1.0f;
|
if (me->size[1] == 0.0f) me->size[1]= 1.0f;
|
||||||
else if (me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
|
else if (me->size[1] > 0.0f && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
|
||||||
else if (me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
|
else if (me->size[1] < 0.0f && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
|
||||||
|
|
||||||
if (me->size[2]==0.0) me->size[2]= 1.0f;
|
if (me->size[2] == 0.0f) me->size[2]= 1.0f;
|
||||||
else if (me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
|
else if (me->size[2] > 0.0f && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
|
||||||
else if (me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
|
else if (me->size[2] < 0.0f && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1522,13 +1519,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size[0]= 0.5f*fabs(bb->vec[0][0] - bb->vec[4][0]);
|
size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]);
|
||||||
size[1]= 0.5f*fabs(bb->vec[0][1] - bb->vec[2][1]);
|
size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]);
|
||||||
size[2]= 0.5f*fabs(bb->vec[0][2] - bb->vec[1][2]);
|
size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]);
|
||||||
|
|
||||||
center[0]= 0.5f*(bb->vec[0][0] + bb->vec[4][0]);
|
center[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]);
|
||||||
center[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]);
|
center[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]);
|
||||||
center[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
|
center[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,7 +109,7 @@
|
|||||||
* KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
|
* KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x)
|
#define KX_BLENDERTRUNC(x) (( x < 0.0001f && x > -0.0001f ) ? 0.0f : x)
|
||||||
|
|
||||||
void BL_ConvertActuators(const char* maggiename,
|
void BL_ConvertActuators(const char* maggiename,
|
||||||
struct Object* blenderobject,
|
struct Object* blenderobject,
|
||||||
@@ -162,7 +162,7 @@ void BL_ConvertActuators(const char* maggiename,
|
|||||||
KX_BLENDERTRUNC(obact->angularvelocity[1]),
|
KX_BLENDERTRUNC(obact->angularvelocity[1]),
|
||||||
KX_BLENDERTRUNC(obact->angularvelocity[2]));
|
KX_BLENDERTRUNC(obact->angularvelocity[2]));
|
||||||
short damping = obact->damping;
|
short damping = obact->damping;
|
||||||
|
|
||||||
/* Blender uses a bit vector internally for the local-flags. In */
|
/* Blender uses a bit vector internally for the local-flags. In */
|
||||||
/* KX, we have four bools. The compiler should be smart enough */
|
/* KX, we have four bools. The compiler should be smart enough */
|
||||||
/* to do the right thing. We need to explicitly convert here! */
|
/* to do the right thing. We need to explicitly convert here! */
|
||||||
@@ -431,7 +431,7 @@ void BL_ConvertActuators(const char* maggiename,
|
|||||||
new KX_SoundActuator(gameobj,
|
new KX_SoundActuator(gameobj,
|
||||||
snd_sound,
|
snd_sound,
|
||||||
soundact->volume,
|
soundact->volume,
|
||||||
(float)(exp((soundact->pitch / 12.0) * M_LN2)),
|
(float)(expf((soundact->pitch / 12.0f) * (float)M_LN2)),
|
||||||
is3d,
|
is3d,
|
||||||
settings,
|
settings,
|
||||||
soundActuatorType);
|
soundActuatorType);
|
||||||
@@ -578,8 +578,8 @@ void BL_ConvertActuators(const char* maggiename,
|
|||||||
/* convert settings... degrees in the ui become radians */
|
/* convert settings... degrees in the ui become radians */
|
||||||
/* internally */
|
/* internally */
|
||||||
if (conact->type == ACT_CONST_TYPE_ORI) {
|
if (conact->type == ACT_CONST_TYPE_ORI) {
|
||||||
min = (float)((MT_2_PI * conact->minloc[0])/360.0);
|
min = (float)(((float)MT_2_PI * conact->minloc[0]) / 360.0f);
|
||||||
max = (float)((MT_2_PI * conact->maxloc[0])/360.0);
|
max = (float)(((float)MT_2_PI * conact->maxloc[0]) / 360.0f);
|
||||||
switch (conact->mode) {
|
switch (conact->mode) {
|
||||||
case ACT_CONST_DIRPX:
|
case ACT_CONST_DIRPX:
|
||||||
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX;
|
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX;
|
||||||
|
@@ -23,14 +23,14 @@
|
|||||||
* Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
*
|
*
|
||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
* Conversion of Blender data blocks to KX sensor system
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file gameengine/Converter/KX_ConvertSensors.cpp
|
/** \file gameengine/Converter/KX_ConvertSensors.cpp
|
||||||
* \ingroup bgeconv
|
* \ingroup bgeconv
|
||||||
|
*
|
||||||
|
* Conversion of Blender data blocks to KX sensor system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
||||||
@@ -476,7 +476,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
|||||||
// or the blenderradarsensor->angle?
|
// or the blenderradarsensor->angle?
|
||||||
// nzc: the angle is the opening angle. We need to init with
|
// nzc: the angle is the opening angle. We need to init with
|
||||||
// the axis-hull angle,so /2.0.
|
// the axis-hull angle,so /2.0.
|
||||||
MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle)/2.0));
|
MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle) / 2.0f));
|
||||||
//MT_Scalar coneradius = coneheight * (factor / 2);
|
//MT_Scalar coneradius = coneheight * (factor / 2);
|
||||||
MT_Scalar coneradius = coneheight * factor;
|
MT_Scalar coneradius = coneheight * factor;
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
|||||||
STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname);
|
STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname);
|
||||||
|
|
||||||
// don't want to get rays of length 0.0 or so
|
// don't want to get rays of length 0.0 or so
|
||||||
double distance = (blenderraysensor->range < 0.01 ? 0.01 : blenderraysensor->range );
|
double distance = (blenderraysensor->range < 0.01f ? 0.01f : blenderraysensor->range);
|
||||||
int axis = blenderraysensor->axisflag;
|
int axis = blenderraysensor->axisflag;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -192,10 +192,10 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis)
|
|||||||
mat[coz][2] = 0.0f;
|
mat[coz][2] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
inp= mat[coz][2];
|
inp = mat[coz][2];
|
||||||
mat[coy][0]= - inp*mat[coz][0];
|
mat[coy][0] = - inp * mat[coz][0];
|
||||||
mat[coy][1]= - inp*mat[coz][1];
|
mat[coy][1] = - inp * mat[coz][1];
|
||||||
mat[coy][2]= 1.0 - inp*mat[coz][2];
|
mat[coy][2] = 1.0f - inp * mat[coz][2];
|
||||||
|
|
||||||
if (Kx_Normalize((float *)mat[coy]) == 0.f) {
|
if (Kx_Normalize((float *)mat[coy]) == 0.f) {
|
||||||
/* the camera is vertical, chose the y axis arbitrary */
|
/* the camera is vertical, chose the y axis arbitrary */
|
||||||
@@ -260,7 +260,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
|
|||||||
/* C2: blender test_visibility function. Can this be a ray-test? */
|
/* C2: blender test_visibility function. Can this be a ray-test? */
|
||||||
|
|
||||||
/* C3: fixed height */
|
/* C3: fixed height */
|
||||||
from[2] = (15.0*from[2] + lookat[2] + m_height)/16.0;
|
from[2] = (15.0f * from[2] + lookat[2] + m_height) / 16.0f;
|
||||||
|
|
||||||
|
|
||||||
/* C4: camera behind actor */
|
/* C4: camera behind actor */
|
||||||
@@ -310,22 +310,22 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
|
inp = fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
|
||||||
fac= (-1.0 + inp) * m_damping;
|
fac = (-1.0f + inp) * m_damping;
|
||||||
|
|
||||||
from[0]+= fac*fp1[0];
|
from[0]+= fac*fp1[0];
|
||||||
from[1]+= fac*fp1[1];
|
from[1]+= fac*fp1[1];
|
||||||
from[2]+= fac*fp1[2];
|
from[2]+= fac*fp1[2];
|
||||||
|
|
||||||
/* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */
|
/* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */
|
||||||
if (inp<0.0) {
|
if (inp < 0.0f) {
|
||||||
if (fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) {
|
if (fp1[0] * fp2[1] - fp1[1] * fp2[0] > 0.0f) {
|
||||||
from[0]-= fac*fp1[1];
|
from[0] -= fac * fp1[1];
|
||||||
from[1]+= fac*fp1[0];
|
from[1] += fac * fp1[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
from[0]+= fac*fp1[1];
|
from[0] += fac * fp1[1];
|
||||||
from[1]-= fac*fp1[0];
|
from[1] -= fac * fp1[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,17 +334,17 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
|
|||||||
rc[0]= (lookat[0]-from[0]);
|
rc[0]= (lookat[0]-from[0]);
|
||||||
rc[1]= (lookat[1]-from[1]);
|
rc[1]= (lookat[1]-from[1]);
|
||||||
rc[2]= (lookat[2]-from[2]);
|
rc[2]= (lookat[2]-from[2]);
|
||||||
distsq= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2];
|
distsq = rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2];
|
||||||
|
|
||||||
if (distsq > maxdistsq) {
|
if (distsq > maxdistsq) {
|
||||||
distsq = 0.15*(distsq-maxdistsq)/distsq;
|
distsq = 0.15f * (distsq - maxdistsq) / distsq;
|
||||||
|
|
||||||
from[0] += distsq*rc[0];
|
from[0] += distsq*rc[0];
|
||||||
from[1] += distsq*rc[1];
|
from[1] += distsq*rc[1];
|
||||||
from[2] += distsq*rc[2];
|
from[2] += distsq*rc[2];
|
||||||
}
|
}
|
||||||
else if (distsq < mindistsq) {
|
else if (distsq < mindistsq) {
|
||||||
distsq = 0.15*(mindistsq-distsq)/mindistsq;
|
distsq = 0.15f * (mindistsq - distsq) / mindistsq;
|
||||||
|
|
||||||
from[0] -= distsq*rc[0];
|
from[0] -= distsq*rc[0];
|
||||||
from[1] -= distsq*rc[1];
|
from[1] -= distsq*rc[1];
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
//
|
*/
|
||||||
|
|
||||||
/** \file KX_GameActuator.h
|
/** \file KX_GameActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
@@ -1,40 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
/** \file gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
|
/** \file gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
*
|
||||||
|
* Add an object when this actuator is triggered
|
||||||
*/
|
*/
|
||||||
//
|
|
||||||
// Add an object when this actuator is triggered
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
//
|
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// The Original Code is: all of this file.
|
|
||||||
//
|
|
||||||
// Contributor(s): none yet.
|
|
||||||
//
|
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
|
||||||
// Previously existed as:
|
|
||||||
|
|
||||||
// \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp
|
|
||||||
|
|
||||||
// Please look here for revision history.
|
|
||||||
|
|
||||||
|
/* Previously existed as:
|
||||||
|
* \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp
|
||||||
|
* Please look here for revision history. */
|
||||||
|
|
||||||
#include "KX_SCA_AddObjectActuator.h"
|
#include "KX_SCA_AddObjectActuator.h"
|
||||||
#include "SCA_IScene.h"
|
#include "SCA_IScene.h"
|
||||||
|
@@ -1,28 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
/** \file KX_SCA_AddObjectActuator.h
|
/** \file KX_SCA_AddObjectActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
@@ -40,7 +41,6 @@
|
|||||||
#include "MT_Vector3.h"
|
#include "MT_Vector3.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SCA_IScene;
|
class SCA_IScene;
|
||||||
|
|
||||||
class KX_SCA_AddObjectActuator : public SCA_IActuator
|
class KX_SCA_AddObjectActuator : public SCA_IActuator
|
||||||
|
@@ -1,41 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
/** \file gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
|
/** \file gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
* Adjust dynamics settins for this object
|
||||||
*/
|
*/
|
||||||
//
|
|
||||||
// Adjust dynamics settins for this object
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
//
|
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// The Original Code is: all of this file.
|
|
||||||
//
|
|
||||||
// Contributor(s): none yet.
|
|
||||||
//
|
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
|
||||||
|
|
||||||
//
|
/* Previously existed as:
|
||||||
// Previously existed as:
|
* \source\gameengine\GameLogic\SCA_DynamicActuator.cpp
|
||||||
|
* Please look here for revision history. */
|
||||||
// \source\gameengine\GameLogic\SCA_DynamicActuator.cpp
|
|
||||||
|
|
||||||
// Please look here for revision history.
|
|
||||||
|
|
||||||
#include "KX_SCA_DynamicActuator.h"
|
#include "KX_SCA_DynamicActuator.h"
|
||||||
|
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): Campbell Barton
|
* Contributor(s): Campbell Barton
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
//
|
*/
|
||||||
|
|
||||||
/** \file KX_SCA_DynamicActuator.h
|
/** \file KX_SCA_DynamicActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
//
|
*/
|
||||||
|
|
||||||
/** \file KX_SCA_EndObjectActuator.h
|
/** \file KX_SCA_EndObjectActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
@@ -1,34 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
/** \file gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
|
/** \file gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
*
|
||||||
|
* Replace the mesh for this actuator's parent
|
||||||
*/
|
*/
|
||||||
//
|
|
||||||
// Replace the mesh for this actuator's parent
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
//
|
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// The Original Code is: all of this file.
|
|
||||||
//
|
|
||||||
// Contributor(s): none yet.
|
|
||||||
//
|
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Previously existed as:
|
// Previously existed as:
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
//
|
*/
|
||||||
|
|
||||||
/** \file KX_SCA_ReplaceMeshActuator.h
|
/** \file KX_SCA_ReplaceMeshActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
//
|
*/
|
||||||
|
|
||||||
/** \file KX_SceneActuator.h
|
/** \file KX_SceneActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
@@ -1,39 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
/** \file gameengine/Ketsji/KX_TrackToActuator.cpp
|
/** \file gameengine/Ketsji/KX_TrackToActuator.cpp
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
*
|
||||||
|
* Replace the mesh for this actuator's parent
|
||||||
*/
|
*/
|
||||||
//
|
|
||||||
// Replace the mesh for this actuator's parent
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
//
|
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// The Original Code is: all of this file.
|
|
||||||
//
|
|
||||||
// Contributor(s): none yet.
|
|
||||||
//
|
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
|
||||||
|
|
||||||
// todo: not all trackflags / upflags are implemented/tested !
|
/* todo: not all trackflags / upflags are implemented/tested !
|
||||||
// m_trackflag is used to determine the forward tracking direction
|
* m_trackflag is used to determine the forward tracking direction
|
||||||
// m_upflag for the up direction
|
* m_upflag for the up direction
|
||||||
// normal situation is +y for forward, +z for up
|
* normal situation is +y for forward, +z for up */
|
||||||
|
|
||||||
#include "MT_Scalar.h"
|
#include "MT_Scalar.h"
|
||||||
#include "SCA_IActuator.h"
|
#include "SCA_IActuator.h"
|
||||||
@@ -50,8 +51,6 @@
|
|||||||
/* Native functions */
|
/* Native functions */
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
|
KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
|
||||||
SCA_IObject *ob,
|
SCA_IObject *ob,
|
||||||
int time,
|
int time,
|
||||||
@@ -123,19 +122,18 @@ MT_Matrix3x3 EulToMat3(float *eul)
|
|||||||
|
|
||||||
|
|
||||||
/* old function from Blender */
|
/* old function from Blender */
|
||||||
void Mat3ToEulOld(MT_Matrix3x3 mat, float *eul)
|
void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3])
|
||||||
{
|
{
|
||||||
MT_Scalar cy;
|
const float cy = sqrtf(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]);
|
||||||
|
|
||||||
cy = sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]);
|
|
||||||
|
|
||||||
if (cy > 16.0*FLT_EPSILON) {
|
if (cy > (float)(16.0f * FLT_EPSILON)) {
|
||||||
eul[0] = atan2(mat[1][2], mat[2][2]);
|
eul[0] = atan2f( mat[1][2], mat[2][2]);
|
||||||
eul[1] = atan2(-mat[0][2], cy);
|
eul[1] = atan2f(-mat[0][2], cy);
|
||||||
eul[2] = atan2(mat[0][1], mat[0][0]);
|
eul[2] = atan2f( mat[0][1], mat[0][0]);
|
||||||
} else {
|
}
|
||||||
eul[0] = atan2(-mat[2][1], mat[1][1]);
|
else {
|
||||||
eul[1] = atan2(-mat[0][2], cy);
|
eul[0] = atan2f(-mat[2][1], mat[1][1]);
|
||||||
|
eul[1] = atan2f(-mat[0][2], cy);
|
||||||
eul[2] = 0.0;
|
eul[2] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,18 +147,18 @@ void compatible_eulFast(float *eul, float *oldrot)
|
|||||||
|
|
||||||
/* angular difference of 360 degrees */
|
/* angular difference of 360 degrees */
|
||||||
|
|
||||||
dx= eul[0] - oldrot[0];
|
dx = eul[0] - oldrot[0];
|
||||||
dy= eul[1] - oldrot[1];
|
dy = eul[1] - oldrot[1];
|
||||||
dz= eul[2] - oldrot[2];
|
dz = eul[2] - oldrot[2];
|
||||||
|
|
||||||
if ( fabs(dx) > MT_PI) {
|
if (fabsf(dx) > (float)MT_PI) {
|
||||||
if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
|
if (dx > 0.0f) eul[0] -= (float)MT_2_PI; else eul[0] += (float)MT_2_PI;
|
||||||
}
|
}
|
||||||
if ( fabs(dy) > MT_PI) {
|
if (fabsf(dy) > (float)MT_PI) {
|
||||||
if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
|
if (dy > 0.0f) eul[1] -= (float)MT_2_PI; else eul[1] += (float)MT_2_PI;
|
||||||
}
|
}
|
||||||
if ( fabs(dz) > MT_PI ) {
|
if (fabsf(dz) > (float)MT_PI) {
|
||||||
if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
|
if (dz > 0.0f) eul[2] -= (float)MT_2_PI; else eul[2] += (float)MT_2_PI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,9 +172,9 @@ MT_Matrix3x3 matrix3x3_interpol(MT_Matrix3x3 oldmat, MT_Matrix3x3 mat, int m_tim
|
|||||||
Mat3ToEulOld(mat, eul);
|
Mat3ToEulOld(mat, eul);
|
||||||
compatible_eulFast(eul, oldeul);
|
compatible_eulFast(eul, oldeul);
|
||||||
|
|
||||||
eul[0]= (m_time*oldeul[0] + eul[0])/(1.0+m_time);
|
eul[0] = (m_time * oldeul[0] + eul[0]) / (1.0f + m_time);
|
||||||
eul[1]= (m_time*oldeul[1] + eul[1])/(1.0+m_time);
|
eul[1] = (m_time * oldeul[1] + eul[1]) / (1.0f + m_time);
|
||||||
eul[2]= (m_time*oldeul[2] + eul[2])/(1.0+m_time);
|
eul[2] = (m_time * oldeul[2] + eul[2]) / (1.0f + m_time);
|
||||||
|
|
||||||
return EulToMat3(eul);
|
return EulToMat3(eul);
|
||||||
}
|
}
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
//
|
/*
|
||||||
// ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
//
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
// of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
//
|
*
|
||||||
// This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
//
|
*
|
||||||
// You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
*
|
||||||
// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// The Original Code is: all of this file.
|
* The Original Code is: all of this file.
|
||||||
//
|
*
|
||||||
// Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
//
|
*
|
||||||
// ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
//
|
*/
|
||||||
|
|
||||||
/** \file KX_TrackToActuator.h
|
/** \file KX_TrackToActuator.h
|
||||||
* \ingroup ketsji
|
* \ingroup ketsji
|
||||||
|
@@ -130,7 +130,7 @@ public:
|
|||||||
float getFrameRate (void) { return m_frameRate; }
|
float getFrameRate (void) { return m_frameRate; }
|
||||||
/// set frame rate
|
/// set frame rate
|
||||||
virtual void setFrameRate (float rate)
|
virtual void setFrameRate (float rate)
|
||||||
{ if (m_isFile) m_frameRate = rate > 0.0 ? rate : 1.0f; }
|
{ if (m_isFile) m_frameRate = rate > 0.0f ? rate : 1.0f; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// video format
|
/// video format
|
||||||
|
Reference in New Issue
Block a user