From 1d6c3f878882448c1752054392c9b0fecb038880 Mon Sep 17 00:00:00 2001 From: Kent Mein Date: Wed, 18 Jan 2006 16:22:29 +0000 Subject: [PATCH] This patch fixes some issues with MSVC 6 See: http://www.blender.org/forum/viewtopic.php?t=7863 I added Pose.c to BPY_python.dsp and moved some variable declarations in OptimizedBvh.cpp so things weren't defined in the middle of code. There is an odd global maxIterations that seems out of place, Erwin you may want to look at it quickly... Kent --- .../Bullet/CollisionShapes/OptimizedBvh.cpp | 52 +++++++++++-------- .../blender/BPY_python/BPY_python.dsp | 4 ++ 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp b/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp index fe3a51883ec..a07e2919bd6 100644 --- a/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp +++ b/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp @@ -84,28 +84,30 @@ void OptimizedBvh::Build(StridingMeshInterface* triangles) OptimizedBvhNode* OptimizedBvh::BuildTree (NodeArray& leafNodes,int startIndex,int endIndex) { + OptimizedBvhNode* internalNode; + int splitAxis, splitIndex, i; int numIndices =endIndex-startIndex; - assert(numIndices>0); - int curIndex = m_curNodeIndex; + assert(numIndices>0); + if (numIndices==1) { return new (&m_contiguousNodes[m_curNodeIndex++]) OptimizedBvhNode(leafNodes[startIndex]); } //calculate Best Splitting Axis and where to split it. Sort the incoming 'leafNodes' array within range 'startIndex/endIndex'. - int splitAxis = CalcSplittingAxis(leafNodes,startIndex,endIndex); + splitAxis = CalcSplittingAxis(leafNodes,startIndex,endIndex); - int splitIndex = SortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis); + splitIndex = SortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis); - OptimizedBvhNode* internalNode = &m_contiguousNodes[m_curNodeIndex++]; + internalNode = &m_contiguousNodes[m_curNodeIndex++]; internalNode->m_aabbMax.setValue(-1e30f,-1e30f,-1e30f); internalNode->m_aabbMin.setValue(1e30f,1e30f,1e30f); - for (int i=startIndex;im_aabbMax.setMax(leafNodes[i].m_aabbMax); internalNode->m_aabbMin.setMin(leafNodes[i].m_aabbMin); @@ -123,21 +125,23 @@ OptimizedBvhNode* OptimizedBvh::BuildTree (NodeArray& leafNodes,int startIndex,i int OptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis) { + int i; int splitIndex =startIndex; int numIndices = endIndex - startIndex; + float splitValue; SimdVector3 means(0.f,0.f,0.f); - for (int i=startIndex;i splitValue) @@ -159,19 +163,20 @@ int OptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex, int OptimizedBvh::CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex) { + int i; + SimdVector3 means(0.f,0.f,0.f); + SimdVector3 variance(0.f,0.f,0.f); int numIndices = endIndex-startIndex; - for (int i=startIndex;i 1000.f) { - for (int i=0;iProcessNode(&node); @@ -205,10 +210,10 @@ void OptimizedBvh::ReportAabbOverlappingNodex(NodeOverlapCallback* nodeCallback, void OptimizedBvh::WalkTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const { - bool aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax); + bool isLeafNode, aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax); if (aabbOverlap) { - bool isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild); + isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild); if (isLeafNode) { nodeCallback->ProcessNode(rootNode); @@ -225,8 +230,9 @@ int maxIterations = 0; void OptimizedBvh::WalkStacklessTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const { - int curIndex = 0; + int escapeIndex, curIndex = 0; int walkIterations = 0; + bool aabbOverlap, isLeafNode; while (curIndex < m_curNodeIndex) { @@ -234,8 +240,8 @@ void OptimizedBvh::WalkStacklessTree(OptimizedBvhNode* rootNode,NodeOverlapCallb assert (walkIterations < m_curNodeIndex); walkIterations++; - bool aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax); - bool isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild); + aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax); + isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild); if (isLeafNode && aabbOverlap) { @@ -248,7 +254,7 @@ void OptimizedBvh::WalkStacklessTree(OptimizedBvhNode* rootNode,NodeOverlapCallb curIndex++; } else { - int escapeIndex = rootNode->m_escapeIndex; + escapeIndex = rootNode->m_escapeIndex; rootNode += escapeIndex; curIndex += escapeIndex; } diff --git a/projectfiles/blender/BPY_python/BPY_python.dsp b/projectfiles/blender/BPY_python/BPY_python.dsp index 648fc3eb199..d2b64cab934 100644 --- a/projectfiles/blender/BPY_python/BPY_python.dsp +++ b/projectfiles/blender/BPY_python/BPY_python.dsp @@ -187,6 +187,10 @@ SOURCE=..\..\..\source\blender\python\api2_2x\Library.c # End Source File # Begin Source File +SOURCE=..\..\..\source\blender\python\api2_2x\Pose.c +# End Source File +# Begin Source File + SOURCE=..\..\..\source\blender\python\api2_2x\logic.c # End Source File # Begin Source File