Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-09-20 21:06:17 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-09-20 21:06:17 +0400
commit9d1b4b63b33b77505f4399a4db4f462f5b1fd1eb (patch)
tree31d83fbd17c4790211707a3ce13c78b664647c23 /source/blender/blenkernel/intern/navmesh_conversion.c
parent0169079bd1c3ce69690153321fb09c3647b9d930 (diff)
Fix for recent commit:
- Some declarations after statement left. - Do not use static inline functions in MOD_navmesh. It produces errors with msvc and not sure it's actually helps -- optimizer should make it inlined itself.
Diffstat (limited to 'source/blender/blenkernel/intern/navmesh_conversion.c')
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index eefc24ee8c6..7df8e902ccd 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -83,10 +83,14 @@ int polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* v
float distPointToSegmentSq(const float* point, const float* a, const float* b)
{
float abx[3], dx[3];
+ float d, t;
+
sub_v3_v3v3(abx, b,a);
sub_v3_v3v3(dx, point,a);
- float d = abx[0]*abx[0]+abx[2]*abx[2];
- float t = abx[0]*dx[0]+abx[2]*dx[2];
+
+ d = abx[0]*abx[0]+abx[2]*abx[2];
+ t = abx[0]*dx[0]+abx[2]*dx[2];
+
if (d > 0)
t /= d;
if (t < 0)
@@ -95,6 +99,7 @@ float distPointToSegmentSq(const float* point, const float* a, const float* b)
t = 1;
dx[0] = a[0] + t*abx[0] - point[0];
dx[2] = a[2] + t*abx[2] - point[2];
+
return dx[0]*dx[0] + dx[2]*dx[2];
}
@@ -107,6 +112,8 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
int *trisToFacesMap;
float *verts;
unsigned short *tris, *tri;
+ int nfaces;
+ MFace *faces;
nverts = dm->getNumVerts(dm);
if (nverts>=0xffff)
@@ -124,8 +131,8 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
}
//calculate number of tris
- int nfaces = dm->getNumFaces(dm);
- MFace *faces = dm->getFaceArray(dm);
+ nfaces = dm->getNumFaces(dm);
+ faces = dm->getFaceArray(dm);
ntris = nfaces;
for (fi=0; fi<nfaces; fi++)
{
@@ -226,8 +233,9 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
{
if (nv==capacity)
{
+ unsigned short* newPolyBig;
capacity += vertsPerPoly;
- unsigned short* newPolyBig = MEM_callocN(sizeof(unsigned short)*capacity, "buildPolygonsByDetailedMeshes newPolyBig");
+ newPolyBig = MEM_callocN(sizeof(unsigned short)*capacity, "buildPolygonsByDetailedMeshes newPolyBig");
memset(newPolyBig, 0xff, sizeof(unsigned short)*capacity);
memcpy(newPolyBig, newPoly, sizeof(unsigned short)*nv);
MEM_freeN(newPoly);