forked from bartvdbraak/blender
code cleanup:
- building without python works again - rename maxi/mini to i_max/i_min (so thay are available for function names) - some minor edits to IK stretch setting (no functional changes).
This commit is contained in:
parent
c41e1e434a
commit
f608b3c444
@ -321,7 +321,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
|
||||
// Find maximum deviation from the segment.
|
||||
float maxd = 0;
|
||||
int maxi = -1;
|
||||
int i_max = -1;
|
||||
int ci, cinc, endi;
|
||||
|
||||
// Traverse the segment in lexilogical order so that the
|
||||
@ -350,7 +350,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
if (d > maxd)
|
||||
{
|
||||
maxd = d;
|
||||
maxi = ci;
|
||||
i_max = ci;
|
||||
}
|
||||
ci = (ci+cinc) % pn;
|
||||
}
|
||||
@ -359,7 +359,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
|
||||
// If the max deviation is larger than accepted error,
|
||||
// add new point, else continue to next segment.
|
||||
if (maxi != -1 && maxd > (maxError*maxError))
|
||||
if (i_max != -1 && maxd > (maxError*maxError))
|
||||
{
|
||||
// Add space for the new point.
|
||||
simplified.resize(simplified.size()+4);
|
||||
@ -372,10 +372,10 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
simplified[j*4+3] = simplified[(j-1)*4+3];
|
||||
}
|
||||
// Add the point.
|
||||
simplified[(i+1)*4+0] = points[maxi*4+0];
|
||||
simplified[(i+1)*4+1] = points[maxi*4+1];
|
||||
simplified[(i+1)*4+2] = points[maxi*4+2];
|
||||
simplified[(i+1)*4+3] = maxi;
|
||||
simplified[(i+1)*4+0] = points[i_max*4+0];
|
||||
simplified[(i+1)*4+1] = points[i_max*4+1];
|
||||
simplified[(i+1)*4+2] = points[i_max*4+2];
|
||||
simplified[(i+1)*4+3] = i_max;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -399,7 +399,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
const int bi = simplified[ii*4+3];
|
||||
|
||||
// Find maximum deviation from the segment.
|
||||
int maxi = -1;
|
||||
int i_max = -1;
|
||||
int ci = (ai+1) % pn;
|
||||
|
||||
// Tessellate only outer edges or edges between areas.
|
||||
@ -423,19 +423,19 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
if (bx > ax || (bx == ax && bz > az))
|
||||
{
|
||||
const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
|
||||
maxi = (ai + n/2) % pn;
|
||||
i_max = (ai + n/2) % pn;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
|
||||
maxi = (ai + (n+1)/2) % pn;
|
||||
i_max = (ai + (n+1)/2) % pn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the max deviation is larger than accepted error,
|
||||
// add new point, else continue to next segment.
|
||||
if (maxi != -1)
|
||||
if (i_max != -1)
|
||||
{
|
||||
// Add space for the new point.
|
||||
simplified.resize(simplified.size()+4);
|
||||
@ -448,10 +448,10 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||
simplified[j*4+3] = simplified[(j-1)*4+3];
|
||||
}
|
||||
// Add the point.
|
||||
simplified[(i+1)*4+0] = points[maxi*4+0];
|
||||
simplified[(i+1)*4+1] = points[maxi*4+1];
|
||||
simplified[(i+1)*4+2] = points[maxi*4+2];
|
||||
simplified[(i+1)*4+3] = maxi;
|
||||
simplified[(i+1)*4+0] = points[i_max*4+0];
|
||||
simplified[(i+1)*4+1] = points[i_max*4+1];
|
||||
simplified[(i+1)*4+2] = points[i_max*4+2];
|
||||
simplified[(i+1)*4+3] = i_max;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
|
||||
while (n > 3)
|
||||
{
|
||||
int minLen = -1;
|
||||
int mini = -1;
|
||||
int i_min = -1;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int i1 = next(i, n);
|
||||
@ -321,12 +321,12 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
|
||||
if (minLen < 0 || len < minLen)
|
||||
{
|
||||
minLen = len;
|
||||
mini = i;
|
||||
i_min = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mini == -1)
|
||||
if (i_min == -1)
|
||||
{
|
||||
// Should not happen.
|
||||
/* printf("mini == -1 ntris=%d n=%d\n", ntris, n);
|
||||
@ -338,7 +338,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
|
||||
return -ntris;
|
||||
}
|
||||
|
||||
int i = mini;
|
||||
int i = i_min;
|
||||
int i1 = next(i, n);
|
||||
int i2 = next(i1, n);
|
||||
|
||||
|
@ -579,23 +579,23 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
|
||||
const float* vb = &edge[b*3];
|
||||
// Find maximum deviation along the segment.
|
||||
float maxd = 0;
|
||||
int maxi = -1;
|
||||
int i_max = -1;
|
||||
for (int m = a+1; m < b; ++m)
|
||||
{
|
||||
float d = distancePtSeg(&edge[m*3],va,vb);
|
||||
if (d > maxd)
|
||||
{
|
||||
maxd = d;
|
||||
maxi = m;
|
||||
i_max = m;
|
||||
}
|
||||
}
|
||||
// If the max deviation is larger than accepted error,
|
||||
// add new point, else continue to next segment.
|
||||
if (maxi != -1 && maxd > rcSqr(sampleMaxError))
|
||||
if (i_max != -1 && maxd > rcSqr(sampleMaxError))
|
||||
{
|
||||
for (int m = nidx; m > k; --m)
|
||||
idx[m] = idx[m-1];
|
||||
idx[k+1] = maxi;
|
||||
idx[k+1] = i_max;
|
||||
nidx++;
|
||||
}
|
||||
else
|
||||
|
@ -242,6 +242,8 @@ static void *ctx_wm_python_context_get(const bContext *C, const char *member, vo
|
||||
if (result.ptr.data)
|
||||
return result.ptr.data;
|
||||
}
|
||||
#else
|
||||
(void)C, (void)member;
|
||||
#endif
|
||||
|
||||
return fall_through;
|
||||
|
@ -304,7 +304,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_declare(fstack);
|
||||
BMLoop *l, *l2;
|
||||
float maxx, maxx_test, cent[3];
|
||||
int i, maxi, flagflip = BMO_slot_bool_get(op, "do_flip");
|
||||
int i, i_max, flagflip = BMO_slot_bool_get(op, "do_flip");
|
||||
|
||||
startf = NULL;
|
||||
maxx = -1.0e10;
|
||||
@ -353,7 +353,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_elem_flag_enable(bm, startf, FACE_VIS);
|
||||
|
||||
i = 0;
|
||||
maxi = 1;
|
||||
i_max = 1;
|
||||
while (i >= 0) {
|
||||
f = fstack[i];
|
||||
i--;
|
||||
@ -381,9 +381,9 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
if (i == maxi) {
|
||||
if (i == i_max) {
|
||||
BLI_array_grow_one(fstack);
|
||||
maxi++;
|
||||
i_max++;
|
||||
}
|
||||
|
||||
fstack[i] = l2->f;
|
||||
|
@ -3469,7 +3469,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
|
||||
|
||||
float rotated, minarea, minangle, area, len;
|
||||
float *angles, miny, maxy, v[2], a[4], mina;
|
||||
int npoints, right, mini, maxi, i, idx[4], nextidx;
|
||||
int npoints, right, i_min, i_max, i, idx[4], nextidx;
|
||||
PVert **points, *p1, *p2, *p3, *p4, *p1n;
|
||||
|
||||
/* compute convex hull */
|
||||
@ -3479,7 +3479,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
|
||||
/* find left/top/right/bottom points, and compute angle for each point */
|
||||
angles = MEM_mallocN(sizeof(float) * npoints, "PMinAreaAngles");
|
||||
|
||||
mini = maxi = 0;
|
||||
i_min = i_max = 0;
|
||||
miny = 1e10;
|
||||
maxy = -1e10;
|
||||
|
||||
@ -3492,19 +3492,19 @@ static float p_chart_minimum_area_angle(PChart *chart)
|
||||
|
||||
if (points[i]->uv[1] < miny) {
|
||||
miny = points[i]->uv[1];
|
||||
mini = i;
|
||||
i_min = i;
|
||||
}
|
||||
if (points[i]->uv[1] > maxy) {
|
||||
maxy = points[i]->uv[1];
|
||||
maxi = i;
|
||||
i_max = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* left, top, right, bottom */
|
||||
idx[0] = 0;
|
||||
idx[1] = maxi;
|
||||
idx[1] = i_max;
|
||||
idx[2] = right;
|
||||
idx[3] = mini;
|
||||
idx[3] = i_min;
|
||||
|
||||
v[0] = points[idx[0]]->uv[0];
|
||||
v[1] = points[idx[0]]->uv[1] + 1.0f;
|
||||
@ -3530,29 +3530,29 @@ static float p_chart_minimum_area_angle(PChart *chart)
|
||||
|
||||
while (rotated <= (float)(M_PI / 2.0)) { /* INVESTIGATE: how far to rotate? */
|
||||
/* rotate with the smallest angle */
|
||||
mini = 0;
|
||||
i_min = 0;
|
||||
mina = 1e10;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
if (a[i] < mina) {
|
||||
mina = a[i];
|
||||
mini = i;
|
||||
i_min = i;
|
||||
}
|
||||
|
||||
rotated += mina;
|
||||
nextidx = (idx[mini] + 1) % npoints;
|
||||
nextidx = (idx[i_min] + 1) % npoints;
|
||||
|
||||
a[mini] = angles[nextidx];
|
||||
a[(mini + 1) % 4] = a[(mini + 1) % 4] - mina;
|
||||
a[(mini + 2) % 4] = a[(mini + 2) % 4] - mina;
|
||||
a[(mini + 3) % 4] = a[(mini + 3) % 4] - mina;
|
||||
a[i_min] = angles[nextidx];
|
||||
a[(i_min + 1) % 4] = a[(i_min + 1) % 4] - mina;
|
||||
a[(i_min + 2) % 4] = a[(i_min + 2) % 4] - mina;
|
||||
a[(i_min + 3) % 4] = a[(i_min + 3) % 4] - mina;
|
||||
|
||||
/* compute area */
|
||||
p1 = points[idx[mini]];
|
||||
p1 = points[idx[i_min]];
|
||||
p1n = points[nextidx];
|
||||
p2 = points[idx[(mini + 1) % 4]];
|
||||
p3 = points[idx[(mini + 2) % 4]];
|
||||
p4 = points[idx[(mini + 3) % 4]];
|
||||
p2 = points[idx[(i_min + 1) % 4]];
|
||||
p3 = points[idx[(i_min + 2) % 4]];
|
||||
p4 = points[idx[(i_min + 3) % 4]];
|
||||
|
||||
len = len_v2v2(p1->uv, p1n->uv);
|
||||
|
||||
@ -3570,7 +3570,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
|
||||
}
|
||||
}
|
||||
|
||||
idx[mini] = nextidx;
|
||||
idx[i_min] = nextidx;
|
||||
}
|
||||
|
||||
/* try keeping rotation as small as possible */
|
||||
|
@ -334,7 +334,8 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
|
||||
IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
|
||||
|
||||
if (tree->stretch && (pchan->ikstretch > 0.0f)) {
|
||||
double ikstretch = (double)pchan->ikstretch * (double)pchan->ikstretch;
|
||||
const float ikstretch = pchan->ikstretch * pchan->ikstretch;
|
||||
/* this function does its own clamping */
|
||||
IK_SetStiffness(seg, IK_TRANS_Y, 1.0f - ikstretch);
|
||||
IK_SetLimit(seg, IK_TRANS_Y, IK_STRETCH_STIFF_MIN, IK_STRETCH_STIFF_MAX);
|
||||
}
|
||||
|
@ -1254,8 +1254,9 @@ static IK_Scene *convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
|
||||
joint = bone->name;
|
||||
joint += ":TY";
|
||||
ret = arm->addSegment(joint, parent, KDL::Joint::TransY, rot[ikchan->ndof - 1]);
|
||||
float ikstretch = pchan->ikstretch * pchan->ikstretch;
|
||||
weight[1] = (1.0 - minf(1.0 - ikstretch, 0.99));
|
||||
const float ikstretch = pchan->ikstretch * pchan->ikstretch;
|
||||
/* why invert twice here? */
|
||||
weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - IK_STRETCH_STIFF_EPS));
|
||||
weights.push_back(weight[1]);
|
||||
}
|
||||
if (!ret)
|
||||
|
@ -1043,9 +1043,11 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
|
||||
delete other;
|
||||
}
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
/* Handle any text datablocks */
|
||||
if (options & LIB_LOAD_LOAD_SCRIPTS)
|
||||
addImportMain(main_newlib);
|
||||
#endif
|
||||
|
||||
/* Now handle all the actions */
|
||||
if (options & LIB_LOAD_LOAD_ACTIONS) {
|
||||
@ -1339,8 +1341,11 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure this maggie is removed from the import list if it's there (this operation is safe if it isn't in the list) */
|
||||
#ifdef WITH_PYTHON
|
||||
/* make sure this maggie is removed from the import list if it's there
|
||||
* (this operation is safe if it isn't in the list) */
|
||||
removeImportMain(maggie);
|
||||
#endif
|
||||
|
||||
free_main(maggie);
|
||||
|
||||
|
@ -29,11 +29,12 @@
|
||||
* \ingroup ketsji
|
||||
*/
|
||||
|
||||
|
||||
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
||||
#pragma warning (disable : 4786)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "KX_Light.h"
|
||||
@ -148,11 +149,12 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
|
||||
//vec[1]= -base->object->obmat[2][1];
|
||||
//vec[2]= -base->object->obmat[2][2];
|
||||
glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPOT_DIRECTION, vec);
|
||||
glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, m_lightobj.m_spotsize/2.0);
|
||||
glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0*m_lightobj.m_spotblend);
|
||||
glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, m_lightobj.m_spotsize / 2.0f);
|
||||
glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0f * m_lightobj.m_spotblend);
|
||||
}
|
||||
else
|
||||
else {
|
||||
glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_lightobj.m_nodiffuse) {
|
||||
|
@ -90,10 +90,11 @@ public:
|
||||
KX_RADAR_AXIS_NEG_Z
|
||||
};
|
||||
|
||||
/* python */
|
||||
virtual sensortype GetSensorType() { return ST_RADAR; }
|
||||
|
||||
/* python */
|
||||
#ifdef WITH_PYTHON
|
||||
static PyObject* pyattr_get_angle(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif //__KX_RADARSENSOR_H__
|
||||
|
Loading…
Reference in New Issue
Block a user