svn merge ^/trunk/blender -r49037:49061

This commit is contained in:
Campbell Barton
2012-07-19 10:29:39 +00:00
47 changed files with 463 additions and 512 deletions

View File

@@ -36,6 +36,10 @@ class MESH_OT_delete_edgeloop(Operator):
bl_idname = "mesh.delete_edgeloop"
bl_label = "Delete Edge Loop"
@classmethod
def poll(cls, context):
return bpy.ops.transform.edge_slide.poll()
def execute(self, context):
if 'FINISHED' in bpy.ops.transform.edge_slide(value=1.0):
bpy.ops.mesh.select_more()

View File

@@ -29,7 +29,6 @@
* \ingroup bke
*/
#include <stddef.h>
#include <math.h>
@@ -98,8 +97,6 @@
#include <string.h>
#endif // WITH_MOD_FLUID
//XXX #include "BIF_screen.h"
EffectorWeights *BKE_add_effector_weights(Group *group)
{
EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");

View File

@@ -29,8 +29,6 @@
* \ingroup bke
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
@@ -65,7 +63,6 @@
#include "BKE_deform.h"
//XXX #include "BIF_editdeform.h"
void calc_lat_fudu(int flag, int res, float *fu, float *du)
{

View File

@@ -78,9 +78,8 @@ variables on the UI for now
#include "BKE_DerivedMesh.h"
#include "BKE_pointcache.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
//XXX #include "BIF_editdeform.h"
//XXX #include "BIF_graphics.h"
#include "BKE_mesh.h"
#include "PIL_time.h"
// #include "ONL_opennl.h" remove linking to ONL for now

View File

@@ -52,11 +52,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
//XXX #include "BIF_toolbox.h"
#include "BKE_font.h"
#include "DNA_vfont_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_curve_types.h"

View File

@@ -95,7 +95,9 @@ void ** g_highlightedNodesRead;
} \
} \
}
void COM_startReadHighlights() {
void COM_startReadHighlights()
{
if (g_highlightedNodesRead) {
delete [] g_highlightedNodesRead;
}
@@ -108,7 +110,8 @@ void COM_startReadHighlights() {
}
}
int COM_isHighlightedbNode(bNode* bnode) {
int COM_isHighlightedbNode(bNode* bnode)
{
if (!g_highlightedNodesRead) return false;
for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
void* p = g_highlightedNodesRead[i];

View File

@@ -1213,6 +1213,8 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op))
/* 2) duplicate base */
newbase = ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */
DAG_scene_sort(bmain, scene);
newob = newbase->object;
newbase->flag &= ~SELECT;

View File

@@ -25,7 +25,6 @@
* \ingroup edarmature
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -49,8 +48,6 @@
#include "BLI_rand.h"
#include "BLI_threads.h"
//#include "BDR_editobject.h"
#include "BKE_constraint.h"
#include "BKE_armature.h"
#include "BKE_context.h"
@@ -60,10 +57,7 @@
#include "BIF_retarget.h"
//#include "mydevice.h"
#include "reeb.h" // FIX ME
//#include "blendef.h"
#include "reeb.h" /* FIX ME */
#include "armature_intern.h"

View File

@@ -22,7 +22,6 @@
* \ingroup edarmature
*/
#include <string.h>
#include <math.h>
#include <float.h>
@@ -49,27 +48,18 @@
#include "ED_screen.h"
#include "BIF_gl.h"
//#include "BIF_screen.h"
//#include "BIF_space.h"
//#include "BIF_mywindow.h"
#include "ED_armature.h"
#include "armature_intern.h"
//#include "BIF_sketch.h"
#include "BIF_retarget.h"
#include "BIF_generate.h"
//#include "BIF_interface.h"
#include "ED_transform.h"
#include "WM_api.h"
#include "WM_types.h"
//#include "blendef.h"
//#include "mydevice.h"
#include "reeb.h"
typedef int (*GestureDetectFct)(bContext *, SK_Gesture *, SK_Sketch *);
typedef void (*GestureApplyFct)(bContext *, SK_Gesture *, SK_Sketch *);

View File

@@ -24,11 +24,10 @@
* \ingroup edarmature
*/
#include <math.h>
#include <string.h> // for memcpy
#include <string.h> /* for memcpy */
#include <stdio.h>
#include <stdlib.h> // for qsort
#include <stdlib.h> /* for qsort */
#include <float.h>
#include "DNA_scene_types.h"
@@ -45,16 +44,8 @@
#include "BLI_ghash.h"
#include "BLI_heap.h"
//#include "BDR_editobject.h"
//#include "BIF_interface.h"
//#include "BIF_toolbox.h"
//#include "BIF_graphics.h"
#include "BKE_mesh.h"
//#include "blendef.h"
#include "ONL_opennl.h"
#include "reeb.h"

View File

@@ -1369,6 +1369,8 @@ static int separate_exec(bContext *C, wmOperator *op)
/* 1. duplicate the object and data */
newbase = ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */
DAG_scene_sort(bmain, scene);
ED_base_object_select(newbase, BA_DESELECT);
newob = newbase->object;

View File

@@ -2815,7 +2815,8 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
CustomData_bmesh_init_pool(&bm_new->ldata, bm_mesh_allocsize_default.totloop, BM_LOOP);
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
basenew = ED_object_add_duplicate(bmain, scene, editbase, USER_DUP_MESH); /* 0 = fully linked */
basenew = ED_object_add_duplicate(bmain, scene, editbase, USER_DUP_MESH);
/* DAG_scene_sort(bmain, scene); */ /* normally would call directly after but in this case delay recalc */
assign_matarar(basenew->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
ED_base_object_select(basenew, BA_DESELECT);
@@ -2968,6 +2969,10 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
if (retval) {
BMEditMesh *em = BMEdit_FromObject(base->object);
/* delay depsgraph recalc until all objects are duplicated */
DAG_scene_sort(bmain, scene);
EDBM_update_generic(C, em, TRUE);
return OPERATOR_FINISHED;

View File

@@ -1854,7 +1854,9 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
/* leaves selection of base/object unaltered.
* note: don't call this within a loop since clear_* funcs loop over the entire database. */
* note: don't call this within a loop since clear_* funcs loop over the entire database.
* note: caller must do DAG_scene_sort(bmain, scene);
* this is not done automatic since we may duplicate many objects in a batch */
Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag)
{
Base *basen;
@@ -1874,7 +1876,8 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
BKE_object_relink(ob);
set_sca_new_poins_ob(ob);
DAG_scene_sort(bmain, scene);
/* DAG_scene_sort(bmain, scene); */ /* caller must do */
if (ob->data) {
ED_render_id_flush_update(bmain, ob->data);
}

View File

@@ -133,6 +133,10 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
if (is_cycle) {
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
}
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
@@ -140,10 +144,6 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
}
}
if (is_cycle) {
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
}
return OPERATOR_CANCELLED;
}

View File

@@ -3142,6 +3142,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
ARegion *ar = CTX_wm_region(C);
bNode *gnode = node_tree_get_editgroup(snode->nodetree);
float mcoords[256][2];
int i = 0;
@@ -3174,6 +3175,10 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
rerouteNode = nodeAddNode(snode->edittree, &ntemp);
rerouteNode->locx = insertPoint[0];
rerouteNode->locy = insertPoint[1];
if (gnode) {
rerouteNode->locx -= gnode->locx;
rerouteNode->locy -= gnode->locy;
}
nodeAddLink(snode->edittree, link->fromnode, link->fromsock, rerouteNode, rerouteNode->inputs.first);
link->fromnode = rerouteNode;

View File

@@ -29,7 +29,6 @@
* \ingroup edtransform
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -37,9 +36,9 @@
#include <float.h>
#ifndef WIN32
#include <unistd.h>
# include <unistd.h>
#else
#include <io.h>
# include <io.h>
#endif
#include "MEM_guardedalloc.h"
@@ -90,10 +89,6 @@
#include "UI_resources.h"
//#include "blendef.h"
//
//#include "mydevice.h"
#include "transform.h"
#include <stdio.h>
@@ -174,8 +169,14 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
if (t->options & CTX_MASK) {
/* clamp w/h, mask only */
divx = divy = maxf(divx, divy);
mulx = muly = minf(mulx, muly);
if (mulx / divx < muly / divy) {
divx = divy = divx;
mulx = muly = mulx;
}
else {
divx = divy = divy;
mulx = muly = muly;
}
}
r_vec[0] = mulx * (dx) / divx;

View File

@@ -53,7 +53,6 @@
#include "BKE_context.h"
#include "ED_image.h"
#include "ED_view3d.h"
@@ -61,13 +60,8 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
//#include "blendef.h"
//
//#include "mydevice.h"
#include "UI_resources.h"
#include "transform.h"
static void drawObjectConstraint(TransInfo *t);

View File

@@ -29,13 +29,12 @@
* \ingroup edtransform
*/
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // for intptr_t support
#include "BLO_sys_types.h" /* for intptr_t support */
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -58,14 +57,8 @@
#include "RNA_access.h"
//#include "BIF_screen.h"
//#include "BIF_mywindow.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
//#include "BIF_editmesh.h"
//#include "BIF_editsima.h"
//#include "BIF_editparticle.h"
//#include "BIF_meshtools.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -96,17 +89,11 @@
#include "ED_clip.h"
#include "ED_screen.h"
//#include "BDR_unwrapper.h"
#include "WM_types.h"
#include "WM_api.h"
#include "UI_resources.h"
//#include "blendef.h"
//
//#include "mydevice.h"
#include "transform.h"
/* ************************** Functions *************************** */

View File

@@ -50,11 +50,6 @@
#include "BLF_translation.h"
//#include "BIF_editmesh.h"
//#include "BIF_interface.h"
//#include "BIF_space.h"
//#include "BIF_toolbox.h"
#include "ED_armature.h"
#include "ED_mesh.h"

View File

@@ -29,7 +29,6 @@
* \ingroup edtransform
*/
#include <stdlib.h>
#include <math.h>
#include <float.h>
@@ -41,7 +40,7 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes
#include "DNA_meshdata_types.h" /* Temporary, for snapping to other unselected meshes */
#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
@@ -54,20 +53,11 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
//#include "BDR_drawobject.h"
//
//#include "editmesh.h"
//#include "BIF_editsima.h"
#include "BIF_gl.h"
//#include "BIF_mywindow.h"
//#include "BIF_screen.h"
//#include "BIF_editsima.h"
//#include "BIF_drawimage.h"
//#include "BIF_editmesh.h"
#include "BKE_DerivedMesh.h"
#include "BKE_object.h"
#include "BKE_anim.h" /* for duplis */
#include "BKE_anim.h" /* for duplis */
#include "BKE_context.h"
#include "BKE_tessmesh.h"
#include "BKE_mesh.h"
@@ -88,8 +78,6 @@
#include "transform.h"
//#include "blendef.h" /* for selection modes */
#define USE_BVH_FACE_SNAP
/********************* PROTOTYPES ***********************/

View File

@@ -48,12 +48,15 @@
#include "BLI_utildefines.h"
/* UNUSED */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
static Main *bpy_import_main = NULL;
static ListBase bpy_import_main_list;
static PyMethodDef bpy_import_meth;
static PyMethodDef bpy_reload_meth;
/* 'builtins' is most likely PyEval_GetBuiltins() */
void bpy_import_init(PyObject *builtins)
{
@@ -335,5 +338,5 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
return newmodule;
}
PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
static PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
static PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};

View File

@@ -55,9 +55,6 @@ PyObject* bpy_text_reimport(PyObject *module, int *found);
void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);
extern PyMethodDef bpy_import_meth;
extern PyMethodDef bpy_reload_meth;
/* The game engine has its own Main struct, if this is set search this rather than G.main */
struct Main *bpy_import_main_get(void);
void bpy_import_main_set(struct Main *maggie);

View File

@@ -152,6 +152,21 @@ void PyC_LineSpit(void)
fprintf(stderr, "%s:%d\n", filename, lineno);
}
void PyC_StackSpit(void)
{
/* Note, allow calling from outside python (RNA) */
if (!PYC_INTERPRETER_ACTIVE) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
}
else {
/* lame but handy */
PyGILState_STATE gilstate = PyGILState_Ensure();
PyRun_SimpleString("__import__('traceback').print_stack()");
PyGILState_Release(gilstate);
}
}
void PyC_FileAndNum(const char **filename, int *lineno)
{
PyFrameObject *frame;

View File

@@ -24,12 +24,13 @@
* \ingroup pygen
*/
#ifndef __PY_CAPI_UTILS_H__
#define __PY_CAPI_UTILS_H__
void PyC_ObSpit(const char *name, PyObject *var);
void PyC_LineSpit(void);
void PyC_StackSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);

View File

@@ -27,7 +27,6 @@
* \ingroup render
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

View File

@@ -27,8 +27,6 @@
* \ingroup render
*/
/* Global includes */
#include <math.h>

View File

@@ -28,7 +28,6 @@
* \ingroup wm
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -63,7 +62,6 @@
#include "BKE_tracking.h" /* free tracking clipboard */
#include "BLI_listbase.h"
// #include "BLI_scanfill.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -75,7 +73,7 @@
#endif
#ifdef WITH_GAMEENGINE
#include "BL_System.h"
# include "BL_System.h"
#endif
#include "GHOST_Path-api.h"
#include "GHOST_C-api.h"

View File

@@ -82,10 +82,6 @@ extern "C" {
/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */
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 "BLI_blenlib.h"
#include "BLO_readfile.h"
@@ -93,7 +89,6 @@ extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
#include "BKE_ipo.h"
/***/
//XXX #include "BSE_headerbuttons.h"
#include "BKE_context.h"
#include "../../blender/windowmanager/WM_types.h"
#include "../../blender/windowmanager/wm_window.h"

View File

@@ -383,8 +383,7 @@ void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
glAccum(GL_LOAD, 1.0);
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_ACCUM, 1-motionblurvalue);
glAccum(GL_RETURN, 1.0);

View File

@@ -258,7 +258,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
joints[2] = -joint_mat[1][0];
norm = normalize_v3(joints);
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 {
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;
sa = len_v3(joints);
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;
} else {
if (ca < 0.0) {

View File

@@ -334,7 +334,7 @@ PyObject* BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_P
}
switch (attr_order) {
case BCA_IKWEIGHT:
return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight:0.0);
return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight : 0.0f);
case BCA_IKTYPE:
return PyLong_FromLong(ikconstraint->type);
case BCA_IKFLAG:
@@ -370,7 +370,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
switch (attr_order) {
case BCA_ENFORCE:
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");
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:
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");
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) {
case BCA_IKWEIGHT:
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");
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:
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");
return PY_SET_ATTR_FAIL;
}

View File

@@ -30,7 +30,6 @@
* \ingroup bgeconv
*/
#if defined(WIN32) && !defined(FREE_WINDOWS)
#pragma warning (disable : 4786)
#endif
@@ -186,10 +185,8 @@ extern Material defmaterial; /* material.c */
#ifdef __cplusplus
extern "C" {
#endif
//XXX #include "BSE_headerbuttons.h"
//XXX void update_for_newframe();
//void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay);
//#include "BKE_ipo.h"
//void do_all_data_ipos(void);
#ifdef __cplusplus
}
@@ -464,10 +461,10 @@ static void GetRGB(short type,
unsigned char cp[4];
unsigned int integer;
} col_converter;
col_converter.cp[3] = (unsigned char) (mat->r*255.0);
col_converter.cp[2] = (unsigned char) (mat->g*255.0);
col_converter.cp[1] = (unsigned char) (mat->b*255.0);
col_converter.cp[0] = (unsigned char) (mat->alpha*255.0);
col_converter.cp[3] = (unsigned char) (mat->r * 255.0f);
col_converter.cp[2] = (unsigned char) (mat->g * 255.0f);
col_converter.cp[1] = (unsigned char) (mat->b * 255.0f);
col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
color = col_converter.integer;
}
c0 = KX_rgbaint2uint_new(color);
@@ -1143,10 +1140,10 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
unsigned int integer;
} col_converter;
col_converter.cp[3] = (unsigned char) (ma->r*255.0);
col_converter.cp[2] = (unsigned char) (ma->g*255.0);
col_converter.cp[1] = (unsigned char) (ma->b*255.0);
col_converter.cp[0] = (unsigned char) (ma->alpha*255.0);
col_converter.cp[3] = (unsigned char) (ma->r * 255.0f);
col_converter.cp[2] = (unsigned char) (ma->g * 255.0f);
col_converter.cp[1] = (unsigned char) (ma->b * 255.0f);
col_converter.cp[0] = (unsigned char) (ma->alpha * 255.0f);
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->rdamping && blenderobject->rdamping <= 1.0f);
shapeProps->m_lin_drag = 1.0 - blenderobject->damping;
shapeProps->m_ang_drag = 1.0 - blenderobject->rdamping;
shapeProps->m_lin_drag = 1.0f - blenderobject->damping;
shapeProps->m_ang_drag = 1.0f - blenderobject->rdamping;
shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0];
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);
me->rot[0]= me->rot[1]= me->rot[2]= 0.0f;
if (me->size[0]==0.0) 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.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
if (me->size[0] == 0.0f) me->size[0] = 1.0f;
else if (me->size[0] > 0.0f && 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;
else if (me->size[1]>0.0 && 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;
if (me->size[1] == 0.0f) me->size[1]= 1.0f;
else if (me->size[1] > 0.0f && 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;
else if (me->size[2]>0.0 && 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;
if (me->size[2] == 0.0f) me->size[2]= 1.0f;
else if (me->size[2] > 0.0f && 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
{
size[0]= 0.5f*fabs(bb->vec[0][0] - bb->vec[4][0]);
size[1]= 0.5f*fabs(bb->vec[0][1] - bb->vec[2][1]);
size[2]= 0.5f*fabs(bb->vec[0][2] - bb->vec[1][2]);
size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]);
size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]);
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[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]);
center[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
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[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]);
}
}

View File

@@ -109,7 +109,7 @@
* 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,
struct Object* blenderobject,
@@ -162,7 +162,7 @@ void BL_ConvertActuators(const char* maggiename,
KX_BLENDERTRUNC(obact->angularvelocity[1]),
KX_BLENDERTRUNC(obact->angularvelocity[2]));
short damping = obact->damping;
/* Blender uses a bit vector internally for the local-flags. In */
/* KX, we have four bools. The compiler should be smart enough */
/* 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,
snd_sound,
soundact->volume,
(float)(exp((soundact->pitch / 12.0) * M_LN2)),
(float)(expf((soundact->pitch / 12.0f) * (float)M_LN2)),
is3d,
settings,
soundActuatorType);
@@ -578,8 +578,8 @@ void BL_ConvertActuators(const char* maggiename,
/* convert settings... degrees in the ui become radians */
/* internally */
if (conact->type == ACT_CONST_TYPE_ORI) {
min = (float)((MT_2_PI * conact->minloc[0])/360.0);
max = (float)((MT_2_PI * conact->maxloc[0])/360.0);
min = (float)(((float)MT_2_PI * conact->minloc[0]) / 360.0f);
max = (float)(((float)MT_2_PI * conact->maxloc[0]) / 360.0f);
switch (conact->mode) {
case ACT_CONST_DIRPX:
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX;

View File

@@ -23,14 +23,14 @@
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
* Conversion of Blender data blocks to KX sensor system
*/
/** \file gameengine/Converter/KX_ConvertSensors.cpp
* \ingroup bgeconv
*
* Conversion of Blender data blocks to KX sensor system
*/
#include <stdio.h>
#if defined(WIN32) && !defined(FREE_WINDOWS)
@@ -476,7 +476,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
// or the blenderradarsensor->angle?
// nzc: the angle is the opening angle. We need to init with
// 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;
@@ -519,7 +519,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname);
// 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;

View File

@@ -192,10 +192,10 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis)
mat[coz][2] = 0.0f;
}
inp= mat[coz][2];
mat[coy][0]= - inp*mat[coz][0];
mat[coy][1]= - inp*mat[coz][1];
mat[coy][2]= 1.0 - inp*mat[coz][2];
inp = mat[coz][2];
mat[coy][0] = - inp * mat[coz][0];
mat[coy][1] = - inp * mat[coz][1];
mat[coy][2] = 1.0f - inp * mat[coz][2];
if (Kx_Normalize((float *)mat[coy]) == 0.f) {
/* 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? */
/* 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 */
@@ -310,22 +310,22 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
break;
}
inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
fac= (-1.0 + inp) * m_damping;
inp = fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
fac = (-1.0f + inp) * m_damping;
from[0]+= fac*fp1[0];
from[1]+= fac*fp1[1];
from[2]+= fac*fp1[2];
/* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */
if (inp<0.0) {
if (fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) {
from[0]-= fac*fp1[1];
from[1]+= fac*fp1[0];
if (inp < 0.0f) {
if (fp1[0] * fp2[1] - fp1[1] * fp2[0] > 0.0f) {
from[0] -= fac * fp1[1];
from[1] += fac * fp1[0];
}
else {
from[0]+= fac*fp1[1];
from[1]-= fac*fp1[0];
from[0] += fac * fp1[1];
from[1] -= fac * fp1[0];
}
}
@@ -334,17 +334,17 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
rc[0]= (lookat[0]-from[0]);
rc[1]= (lookat[1]-from[1]);
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) {
distsq = 0.15*(distsq-maxdistsq)/distsq;
distsq = 0.15f * (distsq - maxdistsq) / distsq;
from[0] += distsq*rc[0];
from[1] += distsq*rc[1];
from[2] += distsq*rc[2];
}
else if (distsq < mindistsq) {
distsq = 0.15*(mindistsq-distsq)/mindistsq;
distsq = 0.15f * (mindistsq - distsq) / mindistsq;
from[0] -= distsq*rc[0];
from[1] -= distsq*rc[1];

View File

@@ -1,29 +1,29 @@
//
// ***** 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 *****
//
/*
* ***** 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 KX_GameActuator.h
* \ingroup ketsji

View File

@@ -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
* \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 "SCA_IScene.h"

View File

@@ -1,28 +1,29 @@
//
// ***** 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 *****
/*
* ***** 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 KX_SCA_AddObjectActuator.h
* \ingroup ketsji
@@ -40,7 +41,6 @@
#include "MT_Vector3.h"
class SCA_IScene;
class KX_SCA_AddObjectActuator : public SCA_IActuator

View File

@@ -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
* \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:
// \source\gameengine\GameLogic\SCA_DynamicActuator.cpp
// Please look here for revision history.
/* Previously existed as:
* \source\gameengine\GameLogic\SCA_DynamicActuator.cpp
* Please look here for revision history. */
#include "KX_SCA_DynamicActuator.h"

View File

@@ -1,29 +1,29 @@
//
// ***** 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): Campbell Barton
//
// ***** END GPL LICENSE BLOCK *****
//
/*
* ***** 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): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file KX_SCA_DynamicActuator.h
* \ingroup ketsji

View File

@@ -1,29 +1,29 @@
//
// ***** 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 *****
//
/*
* ***** 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 KX_SCA_EndObjectActuator.h
* \ingroup ketsji

View File

@@ -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
* \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:

View File

@@ -1,29 +1,29 @@
//
// ***** 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 *****
//
/*
* ***** 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 KX_SCA_ReplaceMeshActuator.h
* \ingroup ketsji

View File

@@ -1,29 +1,29 @@
//
// ***** 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 *****
//
/*
* ***** 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 KX_SceneActuator.h
* \ingroup ketsji

View File

@@ -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
* \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 !
// m_trackflag is used to determine the forward tracking direction
// m_upflag for the up direction
// normal situation is +y for forward, +z for up
/* todo: not all trackflags / upflags are implemented/tested !
* m_trackflag is used to determine the forward tracking direction
* m_upflag for the up direction
* normal situation is +y for forward, +z for up */
#include "MT_Scalar.h"
#include "SCA_IActuator.h"
@@ -50,8 +51,6 @@
/* Native functions */
/* ------------------------------------------------------------------------- */
KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
SCA_IObject *ob,
int time,
@@ -123,19 +122,18 @@ MT_Matrix3x3 EulToMat3(float *eul)
/* old function from Blender */
void Mat3ToEulOld(MT_Matrix3x3 mat, float *eul)
void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3])
{
MT_Scalar cy;
cy = sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]);
const float cy = sqrtf(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]);
if (cy > 16.0*FLT_EPSILON) {
eul[0] = atan2(mat[1][2], mat[2][2]);
eul[1] = atan2(-mat[0][2], cy);
eul[2] = atan2(mat[0][1], mat[0][0]);
} else {
eul[0] = atan2(-mat[2][1], mat[1][1]);
eul[1] = atan2(-mat[0][2], cy);
if (cy > (float)(16.0f * FLT_EPSILON)) {
eul[0] = atan2f( mat[1][2], mat[2][2]);
eul[1] = atan2f(-mat[0][2], cy);
eul[2] = atan2f( mat[0][1], mat[0][0]);
}
else {
eul[0] = atan2f(-mat[2][1], mat[1][1]);
eul[1] = atan2f(-mat[0][2], cy);
eul[2] = 0.0;
}
}
@@ -149,18 +147,18 @@ void compatible_eulFast(float *eul, float *oldrot)
/* angular difference of 360 degrees */
dx= eul[0] - oldrot[0];
dy= eul[1] - oldrot[1];
dz= eul[2] - oldrot[2];
dx = eul[0] - oldrot[0];
dy = eul[1] - oldrot[1];
dz = eul[2] - oldrot[2];
if ( fabs(dx) > MT_PI) {
if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
if (fabsf(dx) > (float)MT_PI) {
if (dx > 0.0f) eul[0] -= (float)MT_2_PI; else eul[0] += (float)MT_2_PI;
}
if ( fabs(dy) > MT_PI) {
if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
if (fabsf(dy) > (float)MT_PI) {
if (dy > 0.0f) eul[1] -= (float)MT_2_PI; else eul[1] += (float)MT_2_PI;
}
if ( fabs(dz) > MT_PI ) {
if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
if (fabsf(dz) > (float)MT_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);
compatible_eulFast(eul, oldeul);
eul[0]= (m_time*oldeul[0] + eul[0])/(1.0+m_time);
eul[1]= (m_time*oldeul[1] + eul[1])/(1.0+m_time);
eul[2]= (m_time*oldeul[2] + eul[2])/(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.0f + m_time);
eul[2] = (m_time * oldeul[2] + eul[2]) / (1.0f + m_time);
return EulToMat3(eul);
}

View File

@@ -1,29 +1,29 @@
//
// ***** 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 *****
//
/*
* ***** 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 KX_TrackToActuator.h
* \ingroup ketsji

View File

@@ -130,7 +130,7 @@ public:
float getFrameRate (void) { return m_frameRate; }
/// set frame 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:
/// video format