Tuesday merger of bf-blender into orange branch.
authorTon Roosendaal <ton@blender.org>
Tue, 10 Jan 2006 22:10:14 +0000 (22:10 +0000)
committerTon Roosendaal <ton@blender.org>
Tue, 10 Jan 2006 22:10:14 +0000 (22:10 +0000)
27 files changed:
1  2 
extern/bullet/Bullet/CollisionShapes/ConvexTriangleCallback.h
extern/bullet/Bullet/CollisionShapes/OptimizedBvh.h
extern/bullet/Bullet/CollisionShapes/TriangleCallback.cpp
extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.h
extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/ipo.c
source/blender/makesdna/DNA_scene_types.h
source/blender/python/api2_2x/Object.c
source/blender/renderconverter/intern/convertBlenderScene.c
source/blender/src/buttons_editing.c
source/blender/src/buttons_scene.c
source/blender/src/drawview.c
source/blender/src/editaction.c
source/blender/src/editconstraint.c
source/blender/src/editipo.c
source/blender/src/editobject.c
source/blender/src/editsima.c
source/blender/src/header_image.c
source/blender/src/header_info.c
source/blender/src/interface.c
source/blender/src/space.c
source/blender/src/toolbox.c
source/gameengine/Ketsji/KX_GameObject.cpp
source/nan_definitions.mk

index 0000000,c9f1a4a..8e0e446
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,50 +1,49 @@@
 -#endif //CONVEX_TRIANGLE_CALLBACK_H
 -
+ #ifndef CONVEX_TRIANGLE_CALLBACK_H
+ #define CONVEX_TRIANGLE_CALLBACK_H
+ #include "TriangleCallback.h"
+ class ConvexShape;
+ class PersistentManifold;
+ #include "SimdTransform.h"
+ ///ConvexTriangleCallback processes the narrowphase convex-triangle collision detection
+ class ConvexTriangleCallback: public TriangleCallback
+ {
+       SimdVector3     m_aabbMin;
+       SimdVector3     m_aabbMax ;
+       SimdTransform   m_triangleMeshTransform;
+       SimdTransform   m_convexTransform;
+ //    bool m_useContinuous;
+       float m_collisionMarginTriangle;
+       
+ public:
+ int   m_triangleCount;
+       
+       ConvexShape*    m_convexShape;
+       PersistentManifold*     m_manifoldPtr;
+       ConvexTriangleCallback(PersistentManifold* manifold,ConvexShape* convexShape,const SimdTransform&convexTransform,const SimdTransform& triangleMeshTransform);
+       void    Update(float collisionMarginTriangle);
+       virtual ~ConvexTriangleCallback();
+       virtual void ProcessTriangle(SimdVector3* triangle);
+       
+       void ClearCache();
+       inline const SimdVector3& GetAabbMin() const
+       {
+               return m_aabbMin;
+       }
+       inline const SimdVector3& GetAabbMax() const
+       {
+               return m_aabbMax;
+       }
+ };
++#endif //CONVEX_TRIANGLE_CALLBACK_H
index 0000000,ca71ded..911bb9a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,93 +1,92 @@@
 -#endif //OPTIMIZED_BVH_H
 -
+ /*
+  * Copyright (c) 2006 Erwin Coumans http://continuousphysics.com/Bullet/
+  *
+  * Permission to use, copy, modify, distribute and sell this software
+  * and its documentation for any purpose is hereby granted without fee,
+  * provided that the above copyright notice appear in all copies.
+  * Erwin Coumans makes no representations about the suitability 
+  * of this software for any purpose.  
+  * It is provided "as is" without express or implied warranty.
+ */
+ #ifndef OPTIMIZED_BVH_H
+ #define OPTIMIZED_BVH_H
+ #include "SimdVector3.h"
+ #include <vector>
+ class StridingMeshInterface;
+ /// OptimizedBvhNode contains both internal and leaf node information.
+ /// It hasn't been optimized yet for storage. Some obvious optimizations are:
+ /// Removal of the pointers (can already be done, they are not used for traversal)
+ /// and storing aabbmin/max as quantized integers.
+ /// 'subpart' doesn't need an integer either. It allows to re-use graphics triangle
+ /// meshes stored in a non-uniform way (like batches/subparts of triangle-fans
+ struct OptimizedBvhNode
+ {
+       SimdVector3     m_aabbMin;
+       SimdVector3     m_aabbMax;
+ //these 2 pointers are obsolete, the stackless traversal just uses the escape index
+       OptimizedBvhNode*       m_leftChild;
+       OptimizedBvhNode*       m_rightChild;
+       int     m_escapeIndex;
+       //for child nodes
+       int     m_subPart;
+       int     m_triangleIndex;
+ };
+ class NodeOverlapCallback
+ {
+ public:
+       virtual void ProcessNode(const OptimizedBvhNode* node) = 0;
+ };
+ typedef std::vector<OptimizedBvhNode> NodeArray;
+ ///OptimizedBvh store an AABB tree that can be quickly traversed on CPU (and SPU,GPU in future)
+ class OptimizedBvh
+ {
+       OptimizedBvhNode*       m_rootNode1;
+       
+       OptimizedBvhNode*       m_contiguousNodes;
+       int                                     m_curNodeIndex;
+       int                                     m_numNodes;
+       NodeArray                       m_leafNodes;
+ public:
+       OptimizedBvh() :m_rootNode1(0), m_numNodes(0) { }
+       
+       void    Build(StridingMeshInterface* triangles);
+       OptimizedBvhNode*       BuildTree       (NodeArray&     leafNodes,int startIndex,int endIndex);
+       int     CalcSplittingAxis(NodeArray&    leafNodes,int startIndex,int endIndex);
+       int     SortAndCalcSplittingIndex(NodeArray&    leafNodes,int startIndex,int endIndex,int splitAxis);
+       
+       void    WalkTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const;
+       
+       void    WalkStacklessTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const;
+       
+       //OptimizedBvhNode*     GetRootNode() { return m_rootNode1;}
+       int                                     GetNumNodes() { return m_numNodes;}
+       void    ReportAabbOverlappingNodex(NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const;
+       void    ReportSphereOverlappingNodex(NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const;
+ };
++#endif //OPTIMIZED_BVH_H
index 0000000,64704dc..6fc6935
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,24 +1,23 @@@
 -}
 -
+ /*
+  * Copyright (c) 2006 Erwin Coumans http://continuousphysics.com/Bullet/
+  *
+  * Permission to use, copy, modify, distribute and sell this software
+  * and its documentation for any purpose is hereby granted without fee,
+  * provided that the above copyright notice appear in all copies.
+  * Erwin Coumans makes no representations about the suitability 
+  * of this software for any purpose.  
+  * It is provided "as is" without express or implied warranty.
+ */
+ #include "TriangleCallback.h"
+ TriangleCallback::~TriangleCallback()
+ {
+ }
+ InternalTriangleIndexCallback::~InternalTriangleIndexCallback()
+ {
++}
index 0000000,1e82950..4784dc3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,47 +1,46 @@@
 -};
 -
+ /*
+  * Copyright (c) 2006 Erwin Coumans http://continuousphysics.com/Bullet/
+  *
+  * Permission to use, copy, modify, distribute and sell this software
+  * and its documentation for any purpose is hereby granted without fee,
+  * provided that the above copyright notice appear in all copies.
+  * Erwin Coumans makes no representations about the suitability 
+  * of this software for any purpose.  
+  * It is provided "as is" without express or implied warranty.
+ */
+ #include "StridingMeshInterface.h"
+ class TriangleIndexVertexArray : public StridingMeshInterface
+ {
+       int                     m_numTriangleIndices;
+       int*            m_triangleIndexBase;
+       int                     m_triangleIndexStride;
+       int                     m_numVertices;
+       float*          m_vertexBase;
+       int                     m_vertexStride;
+       
+ public:
+       TriangleIndexVertexArray(int numTriangleIndices,int* triangleIndexBase,int triangleIndexStride,int numVertices,float* vertexBase,int vertexStride);
+       
+       virtual void    getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0);
+       virtual void    getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const;
+       /// unLockVertexBase finishes the access to a subpart of the triangle mesh
+       /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
+       virtual void    unLockVertexBase(int subpart) {}
+       virtual void    unLockReadOnlyVertexBase(int subpart) const {}
+       /// getNumSubParts returns the number of seperate subparts
+       /// each subpart has a continuous array of vertices and indices
+       virtual int             getNumSubParts() const { return 1;}
+       
+       virtual void    preallocateVertices(int numverts){}
+       virtual void    preallocateIndices(int numindices){}
++};
index 0000000,98e45f6..bb45e52
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,34 +1,33 @@@
 -}
 -
+ #include "ManifoldContactAddResult.h"
+ #include "NarrowPhaseCollision/PersistentManifold.h"
+ ManifoldContactAddResult::ManifoldContactAddResult(SimdTransform transA,SimdTransform transB,PersistentManifold* manifoldPtr)
+               :m_manifoldPtr(manifoldPtr)
+ {
+       m_transAInv = transA.inverse();
+       m_transBInv = transB.inverse();
+ }
+ void ManifoldContactAddResult::AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth)
+ {
+       if (depth > m_manifoldPtr->GetManifoldMargin())
+               return;
+       SimdVector3 pointA = pointInWorld + normalOnBInWorld * depth;
+       SimdVector3 localA = m_transAInv(pointA );
+       SimdVector3 localB = m_transBInv(pointInWorld);
+       ManifoldPoint newPt(localA,localB,normalOnBInWorld,depth);
+       int insertIndex = m_manifoldPtr->GetCacheEntry(newPt);
+       if (insertIndex >= 0)
+       {
+               m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex);
+       } else
+       {
+               m_manifoldPtr->AddManifoldPoint(newPt);
+       }
++}
Simple merge
Simple merge
@@@ -2262,10 -2201,29 +2264,15 @@@ void drawview3dspace(ScrArea *sa, void 
                                draw_object(base, DRAW_CONSTCOLOR);
  
                                if(base->object->transflag & OB_DUPLI) {
 -                                      extern ListBase duplilist;
 -                                      Base tbase;
 -                                      
 -                                      tbase= *base;
 -                                      
 -                                      tbase.flag= OB_FROMDUPLI;
 -                                      make_duplilist(setscene, base->object); /* make_duplilist(G.scene->set, base->object); */
 -                                      ob= duplilist.first;
 -                                      while(ob) {
 -                                              tbase.object= ob;
 -                                              draw_object(&tbase, DRAW_CONSTCOLOR);
 -                                              ob= ob->id.next;
 -                                      }
 -                                      free_duplilist();
 -                                      
 +                                      draw_dupli_objects(v3d, base);
                                }
                        }
+                       
                        base= base->next;
+                       if(base==0 && setscene && setscene->set) {
+                               setscene= setscene->set;
+                               base= setscene->base.first;
+                       }
                }
  
                /* Transp and X-ray afterdraw stuff */
@@@ -2372,6 -2344,8 +2379,7 @@@ void drawview3d_render(struct View3D *v
  {
        extern short v3d_windowmode;
        Base *base;
 -      Object *ob;
+       Scene *setscene;
  
        update_for_newframe_muted();    /* first, since camera can be animated */
  
Simple merge
Simple merge
@@@ -2385,25 -2435,34 +2471,24 @@@ void common_insertkey(void
                                base= base->next;
                        }
                        if(base==NULL) return;
-               
 -
 -                      strcpy(menustr, "Insert Key%t|Loc%x0|Rot%x1|Size%x2|LocRot%x3|LocRotSize%x4|Layer%x5|Avail%x9");
 +                      strcpy(menustr, "Insert Key%t|Loc%x0|Rot%x1|Size%x2|LocRot%x3|LocRotSize%x4|Layer%x5|Avail%x9|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13");
                }
-               
                if(ob) {
                        if(ob->type==OB_MESH) strcat(menustr, "| %x6|Mesh%x7");
                        else if(ob->type==OB_LATTICE) strcat(menustr, "| %x6|Lattice%x7");
                        else if(ob->type==OB_CURVE) strcat(menustr, "| %x6|Curve%x7");
                        else if(ob->type==OB_SURF) strcat(menustr, "| %x6|Surface%x7");
 -                      if(ob->flag & OB_FROMGROUP)     strcat(menustr, "| %x6|Entire Group%x10");
                }
-               
                event= pupmenu(menustr);
                if(event== -1) return;
-               
                if(event==7) { // ob != NULL
                        insert_shapekey(ob);
                        return;
                }
-               
 -              if(event==10) {
 -                      Group *group= find_group(ob);
 -                      if(group) {
 -                              add_group_key(group);
 -                              allqueue(REDRAWBUTSOBJECT, 0);
 -                      }
 -              }
 -
                if (ob && (ob->flag & OB_POSEMODE)){
                        bPoseChannel *pchan;
  
@@@ -4523,11 -4548,3 +4608,12 @@@ void move_to_frame(void
        }
        BIF_undo_push("Set frame to selected Ipo vertex");
  }
 +
 +void bone2objectspace(float obSpaceBoneMat[][4], float obSpace[][4], float restPos[][4])
 +{
 +      float imat[4][4];
 + 
 +      Mat4Invert(imat, restPos);
 +      Mat4MulMat4(obSpaceBoneMat, obSpace, imat);
 +}
++
Simple merge
Simple merge
@@@ -177,7 -177,7 +177,6 @@@ static void save_paint(char *name
  {
        char str[FILE_MAXDIR+FILE_MAXFILE];
        Image *ima = G.sima->image;
--      ImBuf *ibuf;
  
        if (ima  && ima->ibuf) {
                BLI_strncpy(str, name, sizeof(str));
                BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
  
                if (saveover(str)) {
-                       if (BIF_write_ibuf(ibuf, str)) {
 -                      ibuf = IMB_dupImBuf(ima->ibuf);
 -
 -                      if (ibuf) {
 -                              if (BIF_write_ibuf(ibuf, str)) {
 -                                      BLI_strncpy(ima->name, name, sizeof(ima->name));
 -                                      ima->ibuf->userflags &= ~IB_BITMAPDIRTY;
 -                                      allqueue(REDRAWHEADERS, 0);
 -                                      allqueue(REDRAWBUTSSHADING, 0);
 -                              } else {
 -                                      error("Couldn't write image: %s", str);
 -                              }
 -
 -                              IMB_freeImBuf(ibuf);
++                      if (BIF_write_ibuf(ima->ibuf, str)) {
 +                              BLI_strncpy(ima->name, name, sizeof(ima->name));
 +                              ima->ibuf->userflags &= ~IB_BITMAPDIRTY;
 +                              allqueue(REDRAWHEADERS, 0);
 +                              allqueue(REDRAWBUTSSHADING, 0);
 +                      } else {
 +                              error("Couldn't write image: %s", str);
                        }
                }
        }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge