BGE: restore a feature that was lost in 2.48: sharing of display lists between duplic...
authorBenoit Bolsee <benoit.bolsee@online.be>
Sat, 18 Apr 2009 09:14:51 +0000 (09:14 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Sat, 18 Apr 2009 09:14:51 +0000 (09:14 +0000)
source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
source/gameengine/Rasterizer/RAS_MaterialBucket.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h

index 5ddcdd310b088de93f738c7e1a21699822a86918..6beab28d61f3c1e0396b73f20dab3a2c1e400fb0 100644 (file)
@@ -60,7 +60,7 @@ RAS_MeshSlot::RAS_MeshSlot()
 
 RAS_MeshSlot::~RAS_MeshSlot()
 {
-       vector<RAS_DisplayArray*>::iterator it;
+       RAS_DisplayArrayList::iterator it;
 
 #ifdef USE_SPLIT
        Split(true);
@@ -83,7 +83,7 @@ RAS_MeshSlot::~RAS_MeshSlot()
 
 RAS_MeshSlot::RAS_MeshSlot(const RAS_MeshSlot& slot)
 {
-       vector<RAS_DisplayArray*>::iterator it;
+       RAS_DisplayArrayList::iterator it;
 
        m_clientObj = NULL;
        m_pDeformer = NULL;
@@ -205,7 +205,7 @@ RAS_DisplayArray *RAS_MeshSlot::CurrentDisplayArray()
 
 void RAS_MeshSlot::SetDisplayArray(int numverts)
 {
-       vector<RAS_DisplayArray*>::iterator it;
+       RAS_DisplayArrayList::iterator it;
        RAS_DisplayArray *darray = NULL;
        
        for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
@@ -297,7 +297,7 @@ bool RAS_MeshSlot::Equals(RAS_MeshSlot *target)
 
 bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance)
 {
-       vector<RAS_DisplayArray*>::iterator it;
+       RAS_DisplayArrayList::iterator it;
        iterator mit;
        size_t i;
 
@@ -362,7 +362,7 @@ bool RAS_MeshSlot::Split(bool force)
 {
        list<RAS_MeshSlot*>::iterator jit;
        RAS_MeshSlot *target = m_joinSlot;
-       vector<RAS_DisplayArray*>::iterator it, jt;
+       RAS_DisplayArrayList::iterator it, jt;
        iterator mit;
        size_t i, found0 = 0, found1 = 0;
 
index 211770318aeb275c2c386cb04ec28baf82d99e0d..f5c8cd3e1079d2c877aa4e1db3cbd1793c061604 100644 (file)
@@ -86,9 +86,11 @@ public:
 };
 
 /* Entry of a RAS_MeshObject into RAS_MaterialBucket */
+typedef std::vector<RAS_DisplayArray*> RAS_DisplayArrayList;
 
 class RAS_MeshSlot
 {
+       friend class RAS_ListRasterizer;
 private:
        //  indices into display arrays
        int                                                     m_startarray;
@@ -97,7 +99,7 @@ private:
        int                                                     m_endindex;
        int                                                     m_startvertex;
        int                                                     m_endvertex;
-       vector<RAS_DisplayArray*>       m_displayArrays;
+       RAS_DisplayArrayList            m_displayArrays;
 
        // for construction only
        RAS_DisplayArray*                       m_currentArray;
index 2c4b55ff9647093cb1e75357dc4c49258b0d9cf2..65aadd63a401c0f99f27c592bc4535d71e24b174 100644 (file)
@@ -136,10 +136,10 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms)
        */
        RAS_ListSlot* localSlot = (RAS_ListSlot*)ms.m_DisplayList;
        if(!localSlot) {
-               RAS_Lists::iterator it = mLists.find(&ms);
+               RAS_Lists::iterator it = mLists.find(ms.m_displayArrays);
                if(it == mLists.end()) {
                        localSlot = new RAS_ListSlot(this);
-                       mLists.insert(std::pair<RAS_MeshSlot*, RAS_ListSlot*>(&ms, localSlot));
+                       mLists.insert(std::pair<RAS_DisplayArrayList, RAS_ListSlot*>(ms.m_displayArrays, localSlot));
                } else {
                        localSlot = static_cast<RAS_ListSlot*>(it->second->AddRef());
                }
index 96d6d2a995d6819350b443afe92de46ad812f6dd..653bb43e534c7065e59a3d1fc5979c52694c550a 100644 (file)
@@ -35,7 +35,7 @@ enum RAS_ListSlotFlags        {
        LIST_REGEN              =64
 };
 
-typedef std::map<class RAS_MeshSlot*, RAS_ListSlot*> RAS_Lists;
+typedef std::map<RAS_DisplayArrayList, RAS_ListSlot*> RAS_Lists;
 
 class RAS_ListRasterizer : public RAS_VAOpenGLRasterizer
 {