Explorar o código

Fixed bugs in Vector & PODVector.
Use PODVector more extensively.

Lasse Öörni %!s(int64=14) %!d(string=hai) anos
pai
achega
a956f2ff20
Modificáronse 70 ficheiros con 296 adicións e 265 borrados
  1. 0 2
      Engine/Audio/Audio.h
  2. 1 0
      Engine/Audio/Precompiled.h
  3. 9 9
      Engine/Container/PODVector.h
  4. 85 46
      Engine/Container/Vector.h
  5. 1 1
      Engine/Container/VectorBase.h
  6. 0 3
      Engine/Core/Context.h
  7. 2 2
      Engine/Core/Precompiled.h
  8. 0 1
      Engine/Core/ProcessUtils.h
  9. 1 2
      Engine/Core/StringUtils.h
  10. 11 11
      Engine/Core/Variant.cpp
  11. 12 12
      Engine/Core/Variant.h
  12. 23 0
      Engine/Engine/APITemplates.h
  13. 4 4
      Engine/Engine/GraphicsAPI.cpp
  14. 2 2
      Engine/Engine/Precompiled.h
  15. 2 2
      Engine/Graphics/AnimatedModel.cpp
  16. 1 2
      Engine/Graphics/AnimatedModel.h
  17. 1 1
      Engine/Graphics/AnimationController.cpp
  18. 1 2
      Engine/Graphics/AnimationState.h
  19. 1 1
      Engine/Graphics/BillboardSet.cpp
  20. 0 2
      Engine/Graphics/DebugRenderer.h
  21. 3 3
      Engine/Graphics/Drawable.h
  22. 1 2
      Engine/Graphics/OcclusionBuffer.h
  23. 6 5
      Engine/Graphics/Octree.cpp
  24. 6 5
      Engine/Graphics/Octree.h
  25. 8 9
      Engine/Graphics/OctreeQuery.h
  26. 2 2
      Engine/Graphics/ParticleEmitter.cpp
  27. 3 3
      Engine/Graphics/Precompiled.h
  28. 2 2
      Engine/Graphics/Renderer.cpp
  29. 0 1
      Engine/Graphics/Renderer.h
  30. 4 4
      Engine/Graphics/VertexDeclaration.cpp
  31. 4 3
      Engine/Graphics/VertexDeclaration.h
  32. 8 10
      Engine/Graphics/View.cpp
  33. 15 15
      Engine/Graphics/View.h
  34. 2 2
      Engine/IO/Deserializer.cpp
  35. 1 1
      Engine/IO/Deserializer.h
  36. 0 2
      Engine/IO/FileSystem.h
  37. 2 2
      Engine/IO/MemoryBuffer.cpp
  38. 2 2
      Engine/IO/MemoryBuffer.h
  39. 2 2
      Engine/IO/Precompiled.h
  40. 1 1
      Engine/IO/Serializer.cpp
  41. 3 4
      Engine/IO/Serializer.h
  42. 2 2
      Engine/IO/VectorBuffer.cpp
  43. 5 7
      Engine/IO/VectorBuffer.h
  44. 1 3
      Engine/Network/Client.h
  45. 4 2
      Engine/Network/Precompiled.h
  46. 1 1
      Engine/Network/ReplicationState.h
  47. 0 2
      Engine/Network/Server.cpp
  48. 1 2
      Engine/Network/Server.h
  49. 4 4
      Engine/Physics/PhysicsWorld.cpp
  50. 2 3
      Engine/Physics/PhysicsWorld.h
  51. 4 2
      Engine/Physics/Precompiled.h
  52. 0 2
      Engine/Physics/RigidBody.h
  53. 2 2
      Engine/Resource/Precompiled.h
  54. 4 4
      Engine/Resource/XMLElement.cpp
  55. 2 2
      Engine/Resource/XMLElement.h
  56. 0 2
      Engine/Scene/Node.h
  57. 1 2
      Engine/Scene/Precompiled.h
  58. 2 2
      Engine/Scene/Serializable.cpp
  59. 2 2
      Engine/Script/Precompiled.h
  60. 0 4
      Engine/Script/ScriptFile.h
  61. 5 5
      Engine/Script/ScriptInstance.cpp
  62. 2 2
      Engine/Script/ScriptInstance.h
  63. 1 1
      Engine/UI/Font.h
  64. 0 1
      Engine/UI/ListView.h
  65. 2 2
      Engine/UI/Precompiled.h
  66. 6 6
      Tools/AssetImporter/AssetImporter.cpp
  67. 6 8
      Tools/OgreImporter/OgreImporter.cpp
  68. 1 1
      Tools/OgreImporter/OgreImporterUtils.h
  69. 1 1
      Tools/PackageTool/PackageTool.cpp
  70. 3 3
      Tools/ShaderCompiler/ShaderCompiler.cpp

+ 0 - 2
Engine/Audio/Audio.h

@@ -30,8 +30,6 @@
 #include "Thread.h"
 #include "Thread.h"
 #include "SharedArrayPtr.h"
 #include "SharedArrayPtr.h"
 
 
-#include "Vector.h"
-
 class AudioImpl;
 class AudioImpl;
 class Sound;
 class Sound;
 class SoundSource;
 class SoundSource;

+ 1 - 0
Engine/Audio/Precompiled.h

@@ -26,5 +26,6 @@
 #include "StringBase.h"
 #include "StringBase.h"
 
 
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
 #include "Set.h"
 #include "Set.h"
 #include "Vector.h"
 #include "Vector.h"

+ 9 - 9
Engine/Container/PODVector.h

@@ -55,7 +55,7 @@ public:
     /// Destruct
     /// Destruct
     ~PODVector()
     ~PODVector()
     {
     {
-        delete[] reinterpret_cast<unsigned char*>(buffer_);
+        delete[] buffer_;
     }
     }
     
     
     /// Assign from another vector
     /// Assign from another vector
@@ -307,12 +307,12 @@ public:
                 }
                 }
             }
             }
             
             
-            T* newBuffer = reinterpret_cast<T*>(new unsigned char[capacity_ * sizeof(T)]);
+            unsigned char* newBuffer = new unsigned char[capacity_ * sizeof(T)];
             // Move the data into the new buffer and delete the old
             // Move the data into the new buffer and delete the old
             if (buffer_)
             if (buffer_)
             {
             {
-                CopyElements(newBuffer, GetBuffer(), size_);
-                delete[] reinterpret_cast<unsigned char*>(buffer_);
+                CopyElements(reinterpret_cast<T*>(newBuffer), GetBuffer(), size_);
+                delete[] buffer_;
             }
             }
             buffer_ = newBuffer;
             buffer_ = newBuffer;
         }
         }
@@ -328,18 +328,18 @@ public:
         if (newCapacity == capacity_)
         if (newCapacity == capacity_)
             return;
             return;
         
         
-        T* newBuffer = 0;
+        unsigned char* newBuffer = 0;
         capacity_ = newCapacity;
         capacity_ = newCapacity;
         
         
         if (capacity_)
         if (capacity_)
         {
         {
-            newBuffer = reinterpret_cast<T*>(new unsigned char[capacity_ * sizeof(T)]);
+            newBuffer = new unsigned char[capacity_ * sizeof(T)];
             // Move the data into the new buffer
             // Move the data into the new buffer
-            CopyElements(newBuffer, GetBuffer(), size_);
+            CopyElements(reinterpret_cast<T*>(newBuffer), GetBuffer(), size_);
         }
         }
         
         
         // Delete the old buffer
         // Delete the old buffer
-        delete[] reinterpret_cast<unsigned char*>(buffer_);
+        delete[] buffer_;
         buffer_ = newBuffer;
         buffer_ = newBuffer;
     }
     }
     
     
@@ -383,7 +383,7 @@ private:
     void MoveRange(unsigned dest, unsigned src, unsigned count)
     void MoveRange(unsigned dest, unsigned src, unsigned count)
     {
     {
         if (count)
         if (count)
-            memmove(buffer_ + dest, buffer_ + src, count * sizeof(T));
+            memmove(GetBuffer() + dest, GetBuffer() + src, count * sizeof(T));
     }
     }
     
     
     /// Copy elements from one buffer to another
     /// Copy elements from one buffer to another

+ 85 - 46
Engine/Container/Vector.h

@@ -27,6 +27,7 @@
 #include "VectorBase.h"
 #include "VectorBase.h"
 
 
 #include <cstring>
 #include <cstring>
+#include <new>
 
 
 /// Vector template class
 /// Vector template class
 template <class T> class Vector : public VectorBase
 template <class T> class Vector : public VectorBase
@@ -43,7 +44,7 @@ public:
     /// Construct with initial size
     /// Construct with initial size
     explicit Vector(unsigned size)
     explicit Vector(unsigned size)
     {
     {
-        Resize(size);
+        Resize(size, 0);
     }
     }
     
     
     /// Construct from another vector
     /// Construct from another vector
@@ -55,14 +56,15 @@ public:
     /// Destruct
     /// Destruct
     ~Vector()
     ~Vector()
     {
     {
-        delete[] GetBuffer();
+        Clear();
+        delete[] buffer_;
     }
     }
     
     
     /// Assign from another vector
     /// Assign from another vector
     Vector<T>& operator = (const Vector<T>& rhs)
     Vector<T>& operator = (const Vector<T>& rhs)
     {
     {
-        Resize(rhs.size_);
-        CopyElements(GetBuffer(), rhs.GetBuffer(), rhs.size_);
+        Clear();
+        Resize(rhs.size_, rhs.GetBuffer());
         
         
         return *this;
         return *this;
     }
     }
@@ -146,8 +148,7 @@ public:
     void Push(const T& value)
     void Push(const T& value)
     {
     {
         unsigned oldSize = size_;
         unsigned oldSize = size_;
-        Resize(size_ + 1);
-        GetBuffer()[oldSize] = value;
+        Resize(size_ + 1, &value);
     }
     }
     
     
     /// Add another vector at the end
     /// Add another vector at the end
@@ -157,15 +158,14 @@ public:
             return;
             return;
         
         
         unsigned oldSize = size_;
         unsigned oldSize = size_;
-        Resize(size_ + vector.size_);
-        CopyElements(GetBuffer() + oldSize, vector.GetBuffer(), vector.size_);
+        Resize(size_ + vector.size_, vector.GetBuffer());
     }
     }
     
     
     /// Remove the last element
     /// Remove the last element
     void Pop()
     void Pop()
     {
     {
         if (size_)
         if (size_)
-            Resize(size_ - 1);
+            Resize(size_ - 1, 0);
     }
     }
     
     
     /// Insert an element at position
     /// Insert an element at position
@@ -181,7 +181,7 @@ public:
             pos = size_;
             pos = size_;
         
         
         unsigned oldSize = size_;
         unsigned oldSize = size_;
-        Resize(size_ + 1);
+        Resize(size_ + 1, 0);
         MoveRange(pos + 1, pos, oldSize - pos);
         MoveRange(pos + 1, pos, oldSize - pos);
         GetBuffer()[pos] = value;
         GetBuffer()[pos] = value;
     }
     }
@@ -202,7 +202,7 @@ public:
             pos = size_;
             pos = size_;
         
         
         unsigned oldSize = size_;
         unsigned oldSize = size_;
-        Resize(size_ + vector.size_);
+        Resize(size_ + vector.size_, 0);
         MoveRange(pos + vector.size_, pos, oldSize - pos);
         MoveRange(pos + vector.size_, pos, oldSize - pos);
         CopyElements(GetBuffer() + pos, vector.GetBuffer(), vector.size_);
         CopyElements(GetBuffer() + pos, vector.GetBuffer(), vector.size_);
     }
     }
@@ -236,7 +236,7 @@ public:
         if (pos > size_)
         if (pos > size_)
             pos = size_;
             pos = size_;
         unsigned length = end - start;
         unsigned length = end - start;
-        Resize(size_ + length);
+        Resize(size_ + length, 0);
         MoveRange(pos + length, pos, size_ - pos - length);
         MoveRange(pos + length, pos, size_ - pos - length);
         
         
         T* destPtr = GetBuffer() + pos;
         T* destPtr = GetBuffer() + pos;
@@ -254,7 +254,7 @@ public:
             return;
             return;
         
         
         MoveRange(pos, pos + length, size_ - pos - length);
         MoveRange(pos, pos + length, size_ - pos - length);
-        Resize(size_ - length);
+        Resize(size_ - length, 0);
     }
     }
     
     
     /// Erase an element using an iterator
     /// Erase an element using an iterator
@@ -289,35 +289,7 @@ public:
     /// Resize the vector
     /// Resize the vector
     void Resize(unsigned newSize)
     void Resize(unsigned newSize)
     {
     {
-        if (newSize == size_)
-            return;
-        
-        if (newSize > capacity_)
-        {
-            if (!capacity_)
-                capacity_ = newSize;
-            else
-            {
-                while (capacity_ < newSize)
-                {
-                    unsigned increment = capacity_ >> 1;
-                    if (!increment)
-                        increment = 1;
-                    capacity_ += increment;
-                }
-            }
-            
-            T* newBuffer = new T[capacity_];
-            // Move the data into the new buffer and delete the old
-            if (buffer_)
-            {
-                CopyElements(newBuffer, GetBuffer(), size_);
-                delete[] GetBuffer();
-            }
-            buffer_ = newBuffer;
-        }
-        
-        size_ = newSize;
+        Resize(newSize, 0);
     }
     }
     
     
     /// Set new capacity
     /// Set new capacity
@@ -333,14 +305,15 @@ public:
         
         
         if (capacity_)
         if (capacity_)
         {
         {
-            newBuffer = new T[capacity_];
+            newBuffer = reinterpret_cast<T*>(new unsigned char[capacity_ * sizeof(T)]);
             // Move the data into the new buffer
             // Move the data into the new buffer
-            CopyElements(newBuffer, GetBuffer(), size_);
+            ConstructElements(newBuffer, GetBuffer(), size_);
         }
         }
         
         
         // Delete the old buffer
         // Delete the old buffer
-        delete[] GetBuffer();
-        buffer_ = newBuffer;
+        DestructElements(GetBuffer(), size_);
+        delete[] buffer_;
+        buffer_ = reinterpret_cast<unsigned char*>(newBuffer);
     }
     }
     
     
     /// Reallocate so that no extra memory is used
     /// Reallocate so that no extra memory is used
@@ -379,6 +352,50 @@ private:
     /// Return the buffer with right type
     /// Return the buffer with right type
     T* GetBuffer() const { return reinterpret_cast<T*>(buffer_); }
     T* GetBuffer() const { return reinterpret_cast<T*>(buffer_); }
     
     
+   /// Resize the vector and create/remove new elements as necessary
+    void Resize(unsigned newSize, const T* src)
+    {
+        if (newSize == size_)
+            return;
+        
+        // If size shrinks, destruct the removed elements
+        if (newSize < size_)
+            DestructElements(GetBuffer() + newSize, size_ - newSize);
+        else
+        {
+            // Allocate new buffer if necessary and copy the current elements
+            if (newSize > capacity_)
+            {
+                if (!capacity_)
+                    capacity_ = newSize;
+                else
+                {
+                    while (capacity_ < newSize)
+                    {
+                        unsigned increment = capacity_ >> 1;
+                        if (!increment)
+                            increment = 1;
+                        capacity_ += increment;
+                    }
+                }
+                
+                unsigned char* newBuffer = new unsigned char[capacity_ * sizeof(T)];
+                if (buffer_)
+                {
+                    ConstructElements(reinterpret_cast<T*>(newBuffer), GetBuffer(), size_);
+                    DestructElements(GetBuffer(), size_);
+                    delete[] buffer_;
+                }
+                buffer_ = newBuffer;
+            }
+            
+            // Initialize the new elements
+            ConstructElements(GetBuffer() + size_, src, newSize - size_);
+        }
+        
+        size_ = newSize;
+    }
+    
     /// Move a range of elements within the vector
     /// Move a range of elements within the vector
     void MoveRange(unsigned dest, unsigned src, unsigned count)
     void MoveRange(unsigned dest, unsigned src, unsigned count)
     {
     {
@@ -395,10 +412,32 @@ private:
         }
         }
     }
     }
     
     
+    /// Construct elements, optionally with source data
+    static void ConstructElements(T* dest, const T* src, unsigned count)
+    {
+        if (!src)
+        {
+            for (unsigned i = 0; i < count; ++i)
+                new(dest + i) T();
+        }
+        else
+        {
+            for (unsigned i = 0; i < count; ++i)
+                new(dest + i) T(*(src + i));
+        }
+    }
+    
     /// Copy elements from one buffer to another
     /// Copy elements from one buffer to another
     static void CopyElements(T* dest, const T* src, unsigned count)
     static void CopyElements(T* dest, const T* src, unsigned count)
     {
     {
         for (unsigned i = 0; i < count; ++i)
         for (unsigned i = 0; i < count; ++i)
             dest[i] = src[i];
             dest[i] = src[i];
     }
     }
+    
+    // Call the elements' destructors
+    static void DestructElements(T* dest, unsigned count)
+    {
+        for (unsigned i = 0; i < count; ++i)
+            (dest + i)->~T();
+    }
 };
 };

+ 1 - 1
Engine/Container/VectorBase.h

@@ -51,5 +51,5 @@ protected:
     /// Buffer capacity
     /// Buffer capacity
     unsigned capacity_;
     unsigned capacity_;
     /// Buffer
     /// Buffer
-    void* buffer_;
+    unsigned char* buffer_;
 };
 };

+ 0 - 3
Engine/Core/Context.h

@@ -25,10 +25,7 @@
 
 
 #include "Attribute.h"
 #include "Attribute.h"
 #include "Object.h"
 #include "Object.h"
-
-#include "Map.h"
 #include "Set.h"
 #include "Set.h"
-#include "Vector.h"
 
 
 /// Execution context within a process. Provides access to the subsystems, object factories and attributes, and event receivers
 /// Execution context within a process. Provides access to the subsystems, object factories and attributes, and event receivers
 class Context : public RefCounted
 class Context : public RefCounted

+ 2 - 2
Engine/Core/Precompiled.h

@@ -23,8 +23,8 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
 #include "Set.h"
 #include "Set.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 0 - 1
Engine/Core/ProcessUtils.h

@@ -24,7 +24,6 @@
 #pragma once
 #pragma once
 
 
 #include "StringBase.h"
 #include "StringBase.h"
-
 #include "Vector.h"
 #include "Vector.h"
 
 
 class Mutex;
 class Mutex;

+ 1 - 2
Engine/Core/StringUtils.h

@@ -27,9 +27,8 @@
 #include "Quaternion.h"
 #include "Quaternion.h"
 #include "Rect.h"
 #include "Rect.h"
 #include "StringHash.h"
 #include "StringHash.h"
-#include "Vector4.h"
-
 #include "Vector.h"
 #include "Vector.h"
+#include "Vector4.h"
 
 
 /// Split string with a separator char
 /// Split string with a separator char
 Vector<String> Split(const String& source, char separator);
 Vector<String> Split(const String& source, char separator);

+ 11 - 11
Engine/Core/Variant.cpp

@@ -31,7 +31,7 @@
 
 
 const Variant Variant::EMPTY;
 const Variant Variant::EMPTY;
 const String Variant::emptyString;
 const String Variant::emptyString;
-const Vector<unsigned char> Variant::emptyBuffer;
+const PODVector<unsigned char> Variant::emptyBuffer;
 const ResourceRef Variant::emptyResourceRef;
 const ResourceRef Variant::emptyResourceRef;
 const ResourceRefList Variant::emptyResourceRefList;
 const ResourceRefList Variant::emptyResourceRefList;
 const VariantMap Variant::emptyVariantMap;
 const VariantMap Variant::emptyVariantMap;
@@ -68,7 +68,7 @@ Variant& Variant::operator = (const Variant& rhs)
         break;
         break;
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_)) = *(reinterpret_cast<const Vector<unsigned char>*>(rhs.value_.ptr_));
+        *(reinterpret_cast<PODVector<unsigned char>*>(value_.ptr_)) = *(reinterpret_cast<const PODVector<unsigned char>*>(rhs.value_.ptr_));
         break;
         break;
     
     
     case VAR_RESOURCEREF:
     case VAR_RESOURCEREF:
@@ -130,7 +130,7 @@ bool Variant::operator == (const Variant& rhs) const
         return *(reinterpret_cast<const String*>(value_.ptr_)) == *(reinterpret_cast<const String*>(rhs.value_.ptr_));
         return *(reinterpret_cast<const String*>(value_.ptr_)) == *(reinterpret_cast<const String*>(rhs.value_.ptr_));
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        return *(reinterpret_cast<const Vector<unsigned char>*>(value_.ptr_)) == *(reinterpret_cast<const Vector<unsigned char>*>(rhs.value_.ptr_));
+        return *(reinterpret_cast<const PODVector<unsigned char>*>(value_.ptr_)) == *(reinterpret_cast<const PODVector<unsigned char>*>(rhs.value_.ptr_));
         
         
     case VAR_PTR:
     case VAR_PTR:
         return value_.ptr_ == rhs.value_.ptr_;
         return value_.ptr_ == rhs.value_.ptr_;
@@ -178,7 +178,7 @@ void Variant::FromString(const String& type, const String& value)
     else if (typeLower == "buffer")
     else if (typeLower == "buffer")
     {
     {
         SetType(VAR_BUFFER);
         SetType(VAR_BUFFER);
-        Vector<unsigned char>& buffer = *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_));
+        PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(value_.ptr_));
         Vector<String> values = Split(value, ' ');
         Vector<String> values = Split(value, ' ');
         buffer.Resize(values.Size());
         buffer.Resize(values.Size());
         for (unsigned i = 0; i < values.Size(); ++i)
         for (unsigned i = 0; i < values.Size(); ++i)
@@ -222,7 +222,7 @@ void Variant::SetBuffer(const void* data, unsigned size)
         size = 0;
         size = 0;
     
     
     SetType(VAR_BUFFER);
     SetType(VAR_BUFFER);
-    Vector<unsigned char>& buffer = *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_));
+    PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(value_.ptr_));
     buffer.Resize(size);
     buffer.Resize(size);
     if (size)
     if (size)
         memcpy(&buffer[0], data, size);
         memcpy(&buffer[0], data, size);
@@ -266,9 +266,9 @@ String Variant::ToString() const
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
         {
         {
-            const Vector<unsigned char>& buffer = *(reinterpret_cast<const Vector<unsigned char>*>(value_.ptr_));
+            const PODVector<unsigned char>& buffer = *(reinterpret_cast<const PODVector<unsigned char>*>(value_.ptr_));
             String ret;
             String ret;
-            for (Vector<unsigned char>::ConstIterator i = buffer.Begin(); i != buffer.End(); ++i)
+            for (PODVector<unsigned char>::ConstIterator i = buffer.Begin(); i != buffer.End(); ++i)
             {
             {
                 if (i != buffer.Begin())
                 if (i != buffer.Begin())
                     ret += " ";
                     ret += " ";
@@ -305,7 +305,7 @@ void Variant::SetType(VariantType newType)
         break;
         break;
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        delete reinterpret_cast<Vector<unsigned char>*>(value_.ptr_);
+        delete reinterpret_cast<PODVector<unsigned char>*>(value_.ptr_);
         break;
         break;
         
         
     case VAR_RESOURCEREF:
     case VAR_RESOURCEREF:
@@ -334,7 +334,7 @@ void Variant::SetType(VariantType newType)
         break;
         break;
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        *reinterpret_cast<Vector<unsigned char>**>(&value_.ptr_) = new Vector<unsigned char>();
+        *reinterpret_cast<PODVector<unsigned char>**>(&value_.ptr_) = new PODVector<unsigned char>();
         break;
         break;
         
         
     case VAR_RESOURCEREF:
     case VAR_RESOURCEREF:
@@ -415,7 +415,7 @@ template<> const String& Variant::Get<const String&>() const
     return GetString();
     return GetString();
 }
 }
 
 
-template<> const Vector<unsigned char>& Variant::Get<const Vector<unsigned char>& >() const
+template<> const PODVector<unsigned char>& Variant::Get<const PODVector<unsigned char>& >() const
 {
 {
     return GetBuffer();
     return GetBuffer();
 }
 }
@@ -475,7 +475,7 @@ template<> String Variant::Get<String>() const
     return GetString();
     return GetString();
 }
 }
 
 
-template<> Vector<unsigned char> Variant::Get<Vector<unsigned char> >() const
+template<> PODVector<unsigned char> Variant::Get<PODVector<unsigned char> >() const
 {
 {
     return GetBuffer();
     return GetBuffer();
 }
 }

+ 12 - 12
Engine/Core/Variant.h

@@ -24,12 +24,12 @@
 #pragma once
 #pragma once
 
 
 #include "Color.h"
 #include "Color.h"
+#include "Map.h"
+#include "PODVector.h"
 #include "Quaternion.h"
 #include "Quaternion.h"
 #include "StringHash.h"
 #include "StringHash.h"
-#include "Vector4.h"
-
-#include "Map.h"
 #include "Vector.h"
 #include "Vector.h"
+#include "Vector4.h"
 
 
 /// Supported variable types for Variant
 /// Supported variable types for Variant
 enum VariantType
 enum VariantType
@@ -261,7 +261,7 @@ public:
     }
     }
     
     
     /// Construct from a buffer
     /// Construct from a buffer
-    Variant(const Vector<unsigned char>& value) :
+    Variant(const PODVector<unsigned char>& value) :
         type_(VAR_NONE)
         type_(VAR_NONE)
     {
     {
         *this = value;
         *this = value;
@@ -436,10 +436,10 @@ public:
     }
     }
 
 
     /// Assign from a buffer
     /// Assign from a buffer
-    Variant& operator = (const Vector<unsigned char>& rhs)
+    Variant& operator = (const PODVector<unsigned char>& rhs)
     {
     {
         SetType(VAR_BUFFER);
         SetType(VAR_BUFFER);
-        *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_)) = rhs;
+        *(reinterpret_cast<PODVector<unsigned char>*>(value_.ptr_)) = rhs;
         return *this;
         return *this;
     }
     }
     
     
@@ -583,10 +583,10 @@ public:
     }
     }
     
     
     /// Test for equality with a buffer. To return true, both the type and value must match
     /// Test for equality with a buffer. To return true, both the type and value must match
-    bool operator == (const Vector<unsigned char>& rhs) const
+    bool operator == (const PODVector<unsigned char>& rhs) const
     {
     {
         if (type_ == VAR_BUFFER)
         if (type_ == VAR_BUFFER)
-            return *(reinterpret_cast<const Vector<unsigned char>*>(value_.ptr_)) == rhs;
+            return *(reinterpret_cast<const PODVector<unsigned char>*>(value_.ptr_)) == rhs;
         else
         else
             return false;
             return false;
     }
     }
@@ -673,7 +673,7 @@ public:
     /// Test for inequality with a string
     /// Test for inequality with a string
     bool operator != (const String& rhs) const { return !(*this == rhs); }
     bool operator != (const String& rhs) const { return !(*this == rhs); }
     /// Test for inequality with a buffer
     /// Test for inequality with a buffer
-    bool operator != (const Vector<unsigned char>& rhs) const { return !(*this == rhs); }
+    bool operator != (const PODVector<unsigned char>& rhs) const { return !(*this == rhs); }
     /// Test for inequality with a pointer
     /// Test for inequality with a pointer
     bool operator != (void* rhs) const { return !(*this == rhs); }
     bool operator != (void* rhs) const { return !(*this == rhs); }
     /// Test for inequality with an object reference
     /// Test for inequality with an object reference
@@ -791,11 +791,11 @@ public:
     }
     }
     
     
     /// Return buffer or empty on type mismatch
     /// Return buffer or empty on type mismatch
-    const Vector<unsigned char>& GetBuffer() const
+    const PODVector<unsigned char>& GetBuffer() const
     {
     {
         if (type_ != VAR_BUFFER)
         if (type_ != VAR_BUFFER)
             return emptyBuffer;
             return emptyBuffer;
-        return *reinterpret_cast<const Vector<unsigned char>*>(value_.ptr_);
+        return *reinterpret_cast<const PODVector<unsigned char>*>(value_.ptr_);
     }
     }
     
     
     /// Return pointer or null on type mismatch
     /// Return pointer or null on type mismatch
@@ -865,7 +865,7 @@ private:
     /// Empty string
     /// Empty string
     static const String emptyString;
     static const String emptyString;
     /// Empty buffer
     /// Empty buffer
-    static const Vector<unsigned char> emptyBuffer;
+    static const PODVector<unsigned char> emptyBuffer;
     /// Empty object reference
     /// Empty object reference
     static const ResourceRef emptyResourceRef;
     static const ResourceRef emptyResourceRef;
     /// Empty object reference list
     /// Empty object reference list

+ 23 - 0
Engine/Engine/APITemplates.h

@@ -101,6 +101,29 @@ template <class T> CScriptArray* VectorToHandleArray(const Vector<T*>& vector, c
         return 0;
         return 0;
 }
 }
 
 
+/// Template function for PODVector to handle array conversion
+template <class T> CScriptArray* VectorToHandleArray(const PODVector<T*>& vector, const char* arrayName)
+{
+    asIScriptContext *context = asGetActiveContext();
+    if (context)
+    {
+        asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
+        CScriptArray* arr = new CScriptArray(vector.Size(), type);
+        
+        for (unsigned i = 0; i < arr->GetSize(); ++i)
+        {
+            // Increment reference count for storing in the array
+            if (vector[i])
+                vector[i]->AddRef();
+            *(static_cast<T**>(arr->At(i))) = vector[i];
+        }
+        
+        return arr;
+    }
+    else
+        return 0;
+}
+
 /// Template function for shared pointer Vector to handle array conversion
 /// Template function for shared pointer Vector to handle array conversion
 template <class T> CScriptArray* SharedPtrVectorToHandleArray(const Vector<SharedPtr<T> >& vector, const char* arrayName)
 template <class T> CScriptArray* SharedPtrVectorToHandleArray(const Vector<SharedPtr<T> >& vector, const char* arrayName)
 {
 {

+ 4 - 4
Engine/Engine/GraphicsAPI.cpp

@@ -867,7 +867,7 @@ static CScriptArray* OctreeRaycast(const Ray& ray, unsigned char drawableFlags,
 
 
 static CScriptArray* OctreeGetDrawablesPoint(const Vector3& point, unsigned char drawableFlags, Octree* ptr)
 static CScriptArray* OctreeGetDrawablesPoint(const Vector3& point, unsigned char drawableFlags, Octree* ptr)
 {
 {
-    Vector<Drawable*> result;
+    PODVector<Drawable*> result;
     PointOctreeQuery query(result, point, drawableFlags);
     PointOctreeQuery query(result, point, drawableFlags);
     ptr->GetDrawables(query);
     ptr->GetDrawables(query);
     return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
     return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
@@ -875,7 +875,7 @@ static CScriptArray* OctreeGetDrawablesPoint(const Vector3& point, unsigned char
 
 
 static CScriptArray* OctreeGetDrawablesBox(const BoundingBox& box, unsigned char drawableFlags, Octree* ptr)
 static CScriptArray* OctreeGetDrawablesBox(const BoundingBox& box, unsigned char drawableFlags, Octree* ptr)
 {
 {
-    Vector<Drawable*> result;
+    PODVector<Drawable*> result;
     BoxOctreeQuery query(result, box, drawableFlags);
     BoxOctreeQuery query(result, box, drawableFlags);
     ptr->GetDrawables(query);
     ptr->GetDrawables(query);
     return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
     return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
@@ -883,7 +883,7 @@ static CScriptArray* OctreeGetDrawablesBox(const BoundingBox& box, unsigned char
 
 
 static CScriptArray* OctreeGetDrawablesFrustum(const Frustum& frustum, unsigned char drawableFlags, Octree* ptr)
 static CScriptArray* OctreeGetDrawablesFrustum(const Frustum& frustum, unsigned char drawableFlags, Octree* ptr)
 {
 {
-    Vector<Drawable*> result;
+    PODVector<Drawable*> result;
     FrustumOctreeQuery query(result, frustum, drawableFlags);
     FrustumOctreeQuery query(result, frustum, drawableFlags);
     ptr->GetDrawables(query);
     ptr->GetDrawables(query);
     return VectorToHandleArray<Drawable>(result, "Array<Node@>");
     return VectorToHandleArray<Drawable>(result, "Array<Node@>");
@@ -891,7 +891,7 @@ static CScriptArray* OctreeGetDrawablesFrustum(const Frustum& frustum, unsigned
 
 
 static CScriptArray* OctreeGetDrawablesSphere(const Sphere& sphere, unsigned char drawableFlags, Octree* ptr)
 static CScriptArray* OctreeGetDrawablesSphere(const Sphere& sphere, unsigned char drawableFlags, Octree* ptr)
 {
 {
-    Vector<Drawable*> result;
+    PODVector<Drawable*> result;
     SphereOctreeQuery query(result, sphere, drawableFlags);
     SphereOctreeQuery query(result, sphere, drawableFlags);
     ptr->GetDrawables(query);
     ptr->GetDrawables(query);
     return VectorToHandleArray<Drawable>(result, "Array<Node@>");
     return VectorToHandleArray<Drawable>(result, "Array<Node@>");

+ 2 - 2
Engine/Engine/Precompiled.h

@@ -23,7 +23,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 2 - 2
Engine/Graphics/AnimatedModel.cpp

@@ -84,8 +84,8 @@ void AnimatedModel::RegisterObject(Context* context)
     ATTRIBUTE(AnimatedModel, VAR_RESOURCEREFLIST, "Materials", materials_, ResourceRefList(Material::GetTypeStatic()));
     ATTRIBUTE(AnimatedModel, VAR_RESOURCEREFLIST, "Materials", materials_, ResourceRefList(Material::GetTypeStatic()));
     ATTRIBUTE(AnimatedModel, VAR_FLOAT, "Animation LOD Bias", animationLodBias_, 1.0f);
     ATTRIBUTE(AnimatedModel, VAR_FLOAT, "Animation LOD Bias", animationLodBias_, 1.0f);
     ATTRIBUTE(AnimatedModel, VAR_INT, "Raycast/Occlusion LOD Level", softwareLodLevel_, M_MAX_UNSIGNED);
     ATTRIBUTE(AnimatedModel, VAR_INT, "Raycast/Occlusion LOD Level", softwareLodLevel_, M_MAX_UNSIGNED);
-    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Bone Animation Enabled", skeleton_, Vector<unsigned char>());
-    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Animation States", animationStates_, Vector<unsigned char>());
+    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Bone Animation Enabled", skeleton_, PODVector<unsigned char>());
+    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Animation States", animationStates_, PODVector<unsigned char>());
 }
 }
 
 
 void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& value)

+ 1 - 2
Engine/Graphics/AnimatedModel.h

@@ -24,11 +24,10 @@
 #pragma once
 #pragma once
 
 
 #include "Model.h"
 #include "Model.h"
+#include "Set.h"
 #include "Skeleton.h"
 #include "Skeleton.h"
 #include "StaticModel.h"
 #include "StaticModel.h"
 
 
-#include "Set.h"
-
 class Animation;
 class Animation;
 class AnimationState;
 class AnimationState;
 class DebugRenderer;
 class DebugRenderer;

+ 1 - 1
Engine/Graphics/AnimationController.cpp

@@ -53,7 +53,7 @@ void AnimationController::RegisterObject(Context* context)
 {
 {
     context->RegisterFactory<AnimationController>();
     context->RegisterFactory<AnimationController>();
     
     
-    ATTRIBUTE(AnimationController, VAR_BUFFER, "Animations", animations_, Vector<unsigned char>());
+    ATTRIBUTE(AnimationController, VAR_BUFFER, "Animations", animations_, PODVector<unsigned char>());
 }
 }
 
 
 
 

+ 1 - 2
Engine/Graphics/AnimationState.h

@@ -23,9 +23,8 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "SharedPtr.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "SharedPtr.h"
 
 
 class Animation;
 class Animation;
 class AnimatedModel;
 class AnimatedModel;

+ 1 - 1
Engine/Graphics/BillboardSet.cpp

@@ -81,7 +81,7 @@ void BillboardSet::RegisterObject(Context* context)
     ATTRIBUTE(BillboardSet, VAR_BOOL, "Relative Scale", scaled_, true);
     ATTRIBUTE(BillboardSet, VAR_BOOL, "Relative Scale", scaled_, true);
     ATTRIBUTE(BillboardSet, VAR_BOOL, "Sort By Distance", sorted_, false);
     ATTRIBUTE(BillboardSet, VAR_BOOL, "Sort By Distance", sorted_, false);
     ATTRIBUTE(BillboardSet, VAR_RESOURCEREF, "Material", material_, ResourceRef(Material::GetTypeStatic()));
     ATTRIBUTE(BillboardSet, VAR_RESOURCEREF, "Material", material_, ResourceRef(Material::GetTypeStatic()));
-    ATTRIBUTE(BillboardSet, VAR_BUFFER, "Billboards", billboards_, Vector<unsigned char>());
+    ATTRIBUTE(BillboardSet, VAR_BUFFER, "Billboards", billboards_, PODVector<unsigned char>());
 }
 }
 
 
 void BillboardSet::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void BillboardSet::OnSetAttribute(const AttributeInfo& attr, const Variant& value)

+ 0 - 2
Engine/Graphics/DebugRenderer.h

@@ -28,8 +28,6 @@
 #include "Frustum.h"
 #include "Frustum.h"
 #include "SharedPtr.h"
 #include "SharedPtr.h"
 
 
-#include "Vector.h"
-
 class BoundingBox;
 class BoundingBox;
 class Camera;
 class Camera;
 class Frustum;
 class Frustum;

+ 3 - 3
Engine/Graphics/Drawable.h

@@ -25,8 +25,8 @@
 
 
 #include "BoundingBox.h"
 #include "BoundingBox.h"
 #include "Component.h"
 #include "Component.h"
-#include "Node.h"
 #include "GraphicsDefs.h"
 #include "GraphicsDefs.h"
+#include "Node.h"
 
 
 static const unsigned DRAWABLE_GEOMETRY = 0x1;
 static const unsigned DRAWABLE_GEOMETRY = 0x1;
 static const unsigned DRAWABLE_LIGHT = 0x2;
 static const unsigned DRAWABLE_LIGHT = 0x2;
@@ -162,7 +162,7 @@ public:
     /// Return whether has a base pass
     /// Return whether has a base pass
     bool HasBasePass(unsigned batchIndex) const { return (basePassFlags_ & (1 << batchIndex)) != 0; }
     bool HasBasePass(unsigned batchIndex) const { return (basePassFlags_ & (1 << batchIndex)) != 0; }
     /// Return lights
     /// Return lights
-    const Vector<Light*>& GetLights() const { return lights_; }
+    const PODVector<Light*>& GetLights() const { return lights_; }
     
     
 protected:
 protected:
     /// Handle node being assigned
     /// Handle node being assigned
@@ -215,7 +215,7 @@ protected:
     /// Last camera rendered from. Not safe to dereference
     /// Last camera rendered from. Not safe to dereference
     Camera* viewCamera_;
     Camera* viewCamera_;
     /// Lights affecting this drawable, when light count is limited
     /// Lights affecting this drawable, when light count is limited
-    Vector<Light*> lights_;
+    PODVector<Light*> lights_;
     /// Bounding box dirty flag
     /// Bounding box dirty flag
     bool worldBoundingBoxDirty_;
     bool worldBoundingBoxDirty_;
     /// Lod levels dirty flag
     /// Lod levels dirty flag

+ 1 - 2
Engine/Graphics/OcclusionBuffer.h

@@ -22,13 +22,12 @@
 //
 //
 
 
 #pragma once
 #pragma once
+
 #include "Frustum.h"
 #include "Frustum.h"
 #include "Object.h"
 #include "Object.h"
 #include "GraphicsDefs.h"
 #include "GraphicsDefs.h"
 #include "SharedArrayPtr.h"
 #include "SharedArrayPtr.h"
 
 
-#include "Vector.h"
-
 class BoundingBox;
 class BoundingBox;
 class Camera;
 class Camera;
 class IndexBuffer;
 class IndexBuffer;

+ 6 - 5
Engine/Graphics/Octree.cpp

@@ -27,9 +27,10 @@
 #include "Profiler.h"
 #include "Profiler.h"
 #include "Octree.h"
 #include "Octree.h"
 #include "OctreeQuery.h"
 #include "OctreeQuery.h"
-
 #include "Sort.h"
 #include "Sort.h"
 
 
+#include "Log.h"
+
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
 #ifdef _MSC_VER
 #ifdef _MSC_VER
@@ -186,7 +187,7 @@ void Octant::GetDrawablesInternal(OctreeQuery& query, unsigned mask) const
             mask = M_MAX_UNSIGNED;
             mask = M_MAX_UNSIGNED;
     }
     }
     
     
-    for (Vector<Drawable*>::ConstIterator i = drawables_.Begin(); i != drawables_.End(); ++i)
+    for (PODVector<Drawable*>::ConstIterator i = drawables_.Begin(); i != drawables_.End(); ++i)
     {
     {
         Drawable* drawable = *i;
         Drawable* drawable = *i;
         unsigned flags = drawable->GetDrawableFlags();
         unsigned flags = drawable->GetDrawableFlags();
@@ -218,7 +219,7 @@ void Octant::GetDrawablesInternal(RayOctreeQuery& query) const
     if (octantDist >= query.maxDistance_)
     if (octantDist >= query.maxDistance_)
         return;
         return;
     
     
-    for (Vector<Drawable*>::ConstIterator i = drawables_.Begin(); i != drawables_.End(); ++i)
+    for (PODVector<Drawable*>::ConstIterator i = drawables_.Begin(); i != drawables_.End(); ++i)
     {
     {
         Drawable* drawable = *i;
         Drawable* drawable = *i;
         unsigned drawableFlags = drawable->GetDrawableFlags();
         unsigned drawableFlags = drawable->GetDrawableFlags();
@@ -248,7 +249,7 @@ void Octant::Release()
     if ((root_) && (this != root_))
     if ((root_) && (this != root_))
     {
     {
         // Remove the drawables (if any) from this octant to the root octant
         // Remove the drawables (if any) from this octant to the root octant
-        for (Vector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
+        for (PODVector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
         {
         {
             (*i)->SetOctant(root_);
             (*i)->SetOctant(root_);
             root_->drawables_.Push(*i);
             root_->drawables_.Push(*i);
@@ -260,7 +261,7 @@ void Octant::Release()
     else if (!root_)
     else if (!root_)
     {
     {
         // If the whole octree is being destroyed, just detach the drawables
         // If the whole octree is being destroyed, just detach the drawables
-        for (Vector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
+        for (PODVector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
             (*i)->SetOctant(0);
             (*i)->SetOctant(0);
     }
     }
     
     

+ 6 - 5
Engine/Graphics/Octree.h

@@ -24,7 +24,6 @@
 #pragma once
 #pragma once
 
 
 #include "Drawable.h"
 #include "Drawable.h"
-
 #include "Set.h"
 #include "Set.h"
 
 
 class Drawable;
 class Drawable;
@@ -34,6 +33,8 @@ class RayOctreeQuery;
 
 
 static const int NUM_OCTANTS = 8;
 static const int NUM_OCTANTS = 8;
 
 
+#include "stdio.h"
+
 /// Octree octant
 /// Octree octant
 class Octant
 class Octant
 {
 {
@@ -63,13 +64,13 @@ public:
     }
     }
     
     
     /// Remove a drawable object from this octant
     /// Remove a drawable object from this octant
-    void RemoveDrawable(Drawable* drawable, bool reSetOctant = true)
+    void RemoveDrawable(Drawable* drawable, bool resetOctant = true)
     {
     {
-        for (Vector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
+        for (PODVector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
         {
         {
             if (*i == drawable)
             if (*i == drawable)
             {
             {
-                if (reSetOctant)
+                if (resetOctant)
                     drawable->SetOctant(0);
                     drawable->SetOctant(0);
                 drawables_.Erase(i);
                 drawables_.Erase(i);
                 DecDrawableCount();
                 DecDrawableCount();
@@ -141,7 +142,7 @@ protected:
     /// Octree root
     /// Octree root
     Octree* root_;
     Octree* root_;
     /// Drawable objects
     /// Drawable objects
-    Vector<Drawable*> drawables_;
+    PODVector<Drawable*> drawables_;
     /// Number of drawable objects in this octant and child octants
     /// Number of drawable objects in this octant and child octants
     unsigned numDrawables_;
     unsigned numDrawables_;
 };
 };

+ 8 - 9
Engine/Graphics/OctreeQuery.h

@@ -25,11 +25,10 @@
 
 
 #include "BoundingBox.h"
 #include "BoundingBox.h"
 #include "Frustum.h"
 #include "Frustum.h"
+#include "PODVector.h"
 #include "Ray.h"
 #include "Ray.h"
 #include "Sphere.h"
 #include "Sphere.h"
 
 
-#include "Vector.h"
-
 class OcclusionBuffer;
 class OcclusionBuffer;
 class Drawable;
 class Drawable;
 class Node;
 class Node;
@@ -39,7 +38,7 @@ class OctreeQuery
 {
 {
 public:
 public:
     /// Construct with result vector, include/exclude flags and whether to get only occluders or shadowcasters
     /// Construct with result vector, include/exclude flags and whether to get only occluders or shadowcasters
-    OctreeQuery(Vector<Drawable*>& result, unsigned char drawableFlags, bool occludersOnly, bool shadowCastersOnly) :
+    OctreeQuery(PODVector<Drawable*>& result, unsigned char drawableFlags, bool occludersOnly, bool shadowCastersOnly) :
         result_(result),
         result_(result),
         drawableFlags_(drawableFlags),
         drawableFlags_(drawableFlags),
         occludersOnly_(occludersOnly),
         occludersOnly_(occludersOnly),
@@ -58,7 +57,7 @@ public:
     virtual Intersection TestDrawable(const BoundingBox& box, unsigned& mask) const = 0;
     virtual Intersection TestDrawable(const BoundingBox& box, unsigned& mask) const = 0;
     
     
     /// Result vector reference
     /// Result vector reference
-    Vector<Drawable*>& result_;
+    PODVector<Drawable*>& result_;
     /// Drawable flags to include
     /// Drawable flags to include
     unsigned char drawableFlags_;
     unsigned char drawableFlags_;
     /// Get occluders only flag
     /// Get occluders only flag
@@ -72,7 +71,7 @@ class PointOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with point and query parameters
     /// Construct with point and query parameters
-    PointOctreeQuery(Vector<Drawable*>& result, const Vector3& point, unsigned char drawableFlags, bool occludersOnly = false,
+    PointOctreeQuery(PODVector<Drawable*>& result, const Vector3& point, unsigned char drawableFlags, bool occludersOnly = false,
         bool shadowCastersOnly = false) :
         bool shadowCastersOnly = false) :
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         point_(point)
         point_(point)
@@ -93,7 +92,7 @@ class SphereOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with sphere and query parameters
     /// Construct with sphere and query parameters
-    SphereOctreeQuery(Vector<Drawable*>& result, const Sphere& sphere, unsigned char drawableFlags, bool occludersOnly = false,
+    SphereOctreeQuery(PODVector<Drawable*>& result, const Sphere& sphere, unsigned char drawableFlags, bool occludersOnly = false,
         bool shadowCastersOnly = false) :
         bool shadowCastersOnly = false) :
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         sphere_(sphere)
         sphere_(sphere)
@@ -114,7 +113,7 @@ class BoxOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with bounding box and query parameters
     /// Construct with bounding box and query parameters
-    BoxOctreeQuery(Vector<Drawable*>& result, const BoundingBox& box, unsigned char drawableFlags, bool occludersOnly = false,
+    BoxOctreeQuery(PODVector<Drawable*>& result, const BoundingBox& box, unsigned char drawableFlags, bool occludersOnly = false,
         bool shadowCastersOnly = false) :
         bool shadowCastersOnly = false) :
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         box_(box)
         box_(box)
@@ -135,7 +134,7 @@ class FrustumOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with frustum and query parameters
     /// Construct with frustum and query parameters
-    FrustumOctreeQuery(Vector<Drawable*>& result, const Frustum& frustum, unsigned char drawableFlags, bool occludersOnly = false,
+    FrustumOctreeQuery(PODVector<Drawable*>& result, const Frustum& frustum, unsigned char drawableFlags, bool occludersOnly = false,
         bool shadowCastersOnly = false) :
         bool shadowCastersOnly = false) :
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         frustum_(frustum)
         frustum_(frustum)
@@ -156,7 +155,7 @@ class OccludedFrustumOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with frustum, occlusion buffer pointer and query parameters
     /// Construct with frustum, occlusion buffer pointer and query parameters
-    OccludedFrustumOctreeQuery(Vector<Drawable*>& result, const Frustum& frustum, OcclusionBuffer* buffer,
+    OccludedFrustumOctreeQuery(PODVector<Drawable*>& result, const Frustum& frustum, OcclusionBuffer* buffer,
             unsigned char drawableFlags, bool occludersOnly = false, bool shadowCastersOnly = false) :
             unsigned char drawableFlags, bool occludersOnly = false, bool shadowCastersOnly = false) :
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         OctreeQuery(result, drawableFlags, occludersOnly, shadowCastersOnly),
         frustum_(frustum),
         frustum_(frustum),

+ 2 - 2
Engine/Graphics/ParticleEmitter.cpp

@@ -87,8 +87,8 @@ void ParticleEmitter::RegisterObject(Context* context)
     ATTRIBUTE(ParticleEmitter, VAR_FLOAT, "Period Timer", periodTimer_, 0.0f);
     ATTRIBUTE(ParticleEmitter, VAR_FLOAT, "Period Timer", periodTimer_, 0.0f);
     ATTRIBUTE(ParticleEmitter, VAR_FLOAT, "Emission Timer", emissionTimer_, 0.0f);
     ATTRIBUTE(ParticleEmitter, VAR_FLOAT, "Emission Timer", emissionTimer_, 0.0f);
     ATTRIBUTE(ParticleEmitter, VAR_RESOURCEREF, "Parameter Source", parameterSource_, ResourceRef(XMLFile::GetTypeStatic()));
     ATTRIBUTE(ParticleEmitter, VAR_RESOURCEREF, "Parameter Source", parameterSource_, ResourceRef(XMLFile::GetTypeStatic()));
-    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Particles", particles_, Vector<unsigned char>(), AM_SERIALIZATION);
-    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Billboards", billboards_, Vector<unsigned char>(), AM_SERIALIZATION);
+    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Particles", particles_, PODVector<unsigned char>(), AM_SERIALIZATION);
+    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Billboards", billboards_, PODVector<unsigned char>(), AM_SERIALIZATION);
 }
 }
 
 
 void ParticleEmitter::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void ParticleEmitter::OnSetAttribute(const AttributeInfo& attr, const Variant& value)

+ 3 - 3
Engine/Graphics/Precompiled.h

@@ -23,9 +23,9 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
-#include "Sort.h"
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
 #include "Set.h"
 #include "Set.h"
+#include "Sort.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 2 - 2
Engine/Graphics/Renderer.cpp

@@ -671,8 +671,8 @@ void Renderer::DrawDebugGeometry(bool depthTest)
         if (!debug)
         if (!debug)
             continue;
             continue;
         
         
-        const Vector<Drawable*>& geometries = view->GetGeometries();
-        const Vector<Light*>& lights = view->GetLights();
+        const PODVector<Drawable*>& geometries = view->GetGeometries();
+        const PODVector<Light*>& lights = view->GetLights();
         
         
         for (unsigned i = 0; i < geometries.Size(); ++i)
         for (unsigned i = 0; i < geometries.Size(); ++i)
         {
         {

+ 0 - 1
Engine/Graphics/Renderer.h

@@ -27,7 +27,6 @@
 #include "Color.h"
 #include "Color.h"
 #include "Drawable.h"
 #include "Drawable.h"
 #include "RenderSurface.h"
 #include "RenderSurface.h"
-
 #include "Set.h"
 #include "Set.h"
 
 
 class DebugRenderer;
 class DebugRenderer;

+ 4 - 4
Engine/Graphics/VertexDeclaration.cpp

@@ -83,7 +83,7 @@ const BYTE d3dElementUsageIndex[] =
 VertexDeclaration::VertexDeclaration(Graphics* graphics, unsigned elementMask) :
 VertexDeclaration::VertexDeclaration(Graphics* graphics, unsigned elementMask) :
     declaration_(0)
     declaration_(0)
 {
 {
-    Vector<VertexDeclarationElement> elements;
+    PODVector<VertexDeclarationElement> elements;
     unsigned offset = 0;
     unsigned offset = 0;
     
     
     for (unsigned i = 0; i < MAX_VERTEX_ELEMENTS; ++i)
     for (unsigned i = 0; i < MAX_VERTEX_ELEMENTS; ++i)
@@ -109,7 +109,7 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const Vector<VertexBuff
     declaration_(0)
     declaration_(0)
 {
 {
     unsigned usedElementMask = 0;
     unsigned usedElementMask = 0;
-    Vector<VertexDeclarationElement> elements;
+    PODVector<VertexDeclarationElement> elements;
     
     
     for (unsigned i = 0; i < buffers.Size(); ++i)
     for (unsigned i = 0; i < buffers.Size(); ++i)
     {
     {
@@ -150,7 +150,7 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const Vector<SharedPtr<
     declaration_(0)
     declaration_(0)
 {
 {
     unsigned usedElementMask = 0;
     unsigned usedElementMask = 0;
-    Vector<VertexDeclarationElement> elements;
+    PODVector<VertexDeclarationElement> elements;
     
     
     for (unsigned i = 0; i < buffers.Size(); ++i)
     for (unsigned i = 0; i < buffers.Size(); ++i)
     {
     {
@@ -192,7 +192,7 @@ VertexDeclaration::~VertexDeclaration()
     Release();
     Release();
 }
 }
 
 
-void VertexDeclaration::Create(Graphics* graphics, const Vector<VertexDeclarationElement>& elements)
+void VertexDeclaration::Create(Graphics* graphics, const PODVector<VertexDeclarationElement>& elements)
 {
 {
     SharedArrayPtr<D3DVERTEXELEMENT9> elementArray(new D3DVERTEXELEMENT9[elements.Size() + 1]);
     SharedArrayPtr<D3DVERTEXELEMENT9> elementArray(new D3DVERTEXELEMENT9[elements.Size() + 1]);
     
     

+ 4 - 3
Engine/Graphics/VertexDeclaration.h

@@ -23,11 +23,12 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "RefCounted.h"
 #include "GraphicsDefs.h"
 #include "GraphicsDefs.h"
+#include "PODVector.h"
+#include "RefCounted.h"
+#include "Vector.h"
 
 
 #include <d3d9.h>
 #include <d3d9.h>
-#include "Vector.h"
 
 
 class Graphics;
 class Graphics;
 class VertexBuffer;
 class VertexBuffer;
@@ -61,7 +62,7 @@ public:
     
     
 private:
 private:
     /// Create declaration
     /// Create declaration
-    void Create(Graphics* graphics, const Vector<VertexDeclarationElement>& elements);
+    void Create(Graphics* graphics, const PODVector<VertexDeclarationElement>& elements);
     /// Release declaration
     /// Release declaration
     void Release();
     void Release();
     
     

+ 8 - 10
Engine/Graphics/View.cpp

@@ -271,8 +271,8 @@ void View::GetDrawables()
     Vector3 cameraPos = camera_->GetWorldPosition();
     Vector3 cameraPos = camera_->GetWorldPosition();
     
     
     // Get zones & find the zone camera is in
     // Get zones & find the zone camera is in
-    Vector<Zone*> zones;
-    PointOctreeQuery query(reinterpret_cast<Vector<Drawable*>& >(zones), cameraPos, DRAWABLE_ZONE);
+    PODVector<Zone*> zones;
+    PointOctreeQuery query(reinterpret_cast<PODVector<Drawable*>& >(zones), cameraPos, DRAWABLE_ZONE);
     octree_->GetDrawables(query);
     octree_->GetDrawables(query);
     
     
     int highestZonePriority = M_MIN_INT;
     int highestZonePriority = M_MIN_INT;
@@ -292,8 +292,7 @@ void View::GetDrawables()
     
     
     if (maxOccluderTriangles_ > 0)
     if (maxOccluderTriangles_ > 0)
     {
     {
-        FrustumOctreeQuery query(reinterpret_cast<Vector<Drawable*>& >(occluders_), camera_->GetFrustum(),
-            DRAWABLE_GEOMETRY, true, false);
+        FrustumOctreeQuery query(occluders_, camera_->GetFrustum(), DRAWABLE_GEOMETRY, true, false);
         
         
         octree_->GetDrawables(query);
         octree_->GetDrawables(query);
         UpdateOccluders(occluders_, camera_);
         UpdateOccluders(occluders_, camera_);
@@ -528,7 +527,7 @@ void View::GetBatches()
         {
         {
             Drawable* drawable = *i;
             Drawable* drawable = *i;
             drawable->LimitLights();
             drawable->LimitLights();
-            const Vector<Light*>& lights = drawable->GetLights();
+            const PODVector<Light*>& lights = drawable->GetLights();
             
             
             for (unsigned i = 0; i < lights.Size(); ++i)
             for (unsigned i = 0; i < lights.Size(); ++i)
             {
             {
@@ -1061,7 +1060,7 @@ void View::RenderBatchesDeferred()
     }
     }
 }
 }
 
 
-void View::UpdateOccluders(Vector<Drawable*>& occluders, Camera* camera)
+void View::UpdateOccluders(PODVector<Drawable*>& occluders, Camera* camera)
 {
 {
     float occluderSizeThreshold_ = renderer_->GetOccluderSizeThreshold();
     float occluderSizeThreshold_ = renderer_->GetOccluderSizeThreshold();
     float halfViewSize = camera->GetHalfViewSize();
     float halfViewSize = camera->GetHalfViewSize();
@@ -1125,7 +1124,7 @@ void View::UpdateOccluders(Vector<Drawable*>& occluders, Camera* camera)
         Sort(occluders.Begin(), occluders.End(), CompareDrawables);
         Sort(occluders.Begin(), occluders.End(), CompareDrawables);
 }
 }
 
 
-void View::DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occluders)
+void View::DrawOccluders(OcclusionBuffer* buffer, const PODVector<Drawable*>& occluders)
 {
 {
     for (unsigned i = 0; i < occluders.Size(); ++i)
     for (unsigned i = 0; i < occluders.Size(); ++i)
     {
     {
@@ -1184,8 +1183,7 @@ unsigned View::ProcessLight(Light* light)
         SetupShadowCamera(light, true);
         SetupShadowCamera(light, true);
         
         
         // Get occluders, which must be shadow-casting themselves
         // Get occluders, which must be shadow-casting themselves
-        FrustumOctreeQuery query(reinterpret_cast<Vector<Drawable*>& >(shadowOccluders_), shadowCamera->GetFrustum(),
-            DRAWABLE_GEOMETRY, true, true);
+        FrustumOctreeQuery query(shadowOccluders_, shadowCamera->GetFrustum(), DRAWABLE_GEOMETRY, true, true);
         octree_->GetDrawables(query);
         octree_->GetDrawables(query);
         
         
         UpdateOccluders(shadowOccluders_, shadowCamera);
         UpdateOccluders(shadowOccluders_, shadowCamera);
@@ -1391,7 +1389,7 @@ unsigned View::ProcessLight(Light* light)
     return numSplits;
     return numSplits;
 }
 }
 
 
-void View::ProcessLightQuery(unsigned splitIndex, const Vector<Drawable*>& result, BoundingBox& geometryBox,
+void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& result, BoundingBox& geometryBox,
     BoundingBox& shadowCasterBox, bool getLitGeometries, bool GetShadowCasters)
     BoundingBox& shadowCasterBox, bool getLitGeometries, bool GetShadowCasters)
 {
 {
     Light* light = splitLights_[splitIndex];
     Light* light = splitLights_[splitIndex];

+ 15 - 15
Engine/Graphics/View.h

@@ -127,13 +127,13 @@ public:
     /// Return the depth stencil. 0 if using the backbuffer's depth stencil
     /// Return the depth stencil. 0 if using the backbuffer's depth stencil
     RenderSurface* GetDepthStencil() const { return depthStencil_; }
     RenderSurface* GetDepthStencil() const { return depthStencil_; }
     /// Return geometry objects
     /// Return geometry objects
-    const Vector<Drawable*>& GetGeometries() const { return geometries_; }
+    const PODVector<Drawable*>& GetGeometries() const { return geometries_; }
     /// Return occluder objects
     /// Return occluder objects
-    const Vector<Drawable*>& GetOccluders() const { return occluders_; }
+    const PODVector<Drawable*>& GetOccluders() const { return occluders_; }
     /// Return directional light shadow rendering occluders
     /// Return directional light shadow rendering occluders
-    const Vector<Drawable*>& GetShadowOccluders() const { return shadowOccluders_; }
+    const PODVector<Drawable*>& GetShadowOccluders() const { return shadowOccluders_; }
     /// Return lights
     /// Return lights
-    const Vector<Light*>& GetLights() const { return lights_; }
+    const PODVector<Light*>& GetLights() const { return lights_; }
     /// Return light batch queues
     /// Return light batch queues
     const Vector<LightBatchQueue>& GetLightQueues() const { return lightQueues_; }
     const Vector<LightBatchQueue>& GetLightQueues() const { return lightQueues_; }
     
     
@@ -149,13 +149,13 @@ private:
     /// Render batches, deferred mode
     /// Render batches, deferred mode
     void RenderBatchesDeferred();
     void RenderBatchesDeferred();
     /// Query for occluders as seen from a camera
     /// Query for occluders as seen from a camera
-    void UpdateOccluders(Vector<Drawable*>& occluders, Camera* camera);
+    void UpdateOccluders(PODVector<Drawable*>& occluders, Camera* camera);
     /// Draw occluders to occlusion buffer
     /// Draw occluders to occlusion buffer
-    void DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occluders);
+    void DrawOccluders(OcclusionBuffer* buffer, const PODVector<Drawable*>& occluders);
     /// Query for lit geometries and shadow casters for a light
     /// Query for lit geometries and shadow casters for a light
     unsigned ProcessLight(Light* light);
     unsigned ProcessLight(Light* light);
     /// Generate combined bounding boxes for lit geometries and shadow casters and check shadow caster visibility
     /// Generate combined bounding boxes for lit geometries and shadow casters and check shadow caster visibility
-    void ProcessLightQuery(unsigned splitIndex, const Vector<Drawable*>& result, BoundingBox& geometryBox, BoundingBox& shadowSpaceBox, bool getLitGeometries, bool GetShadowCasters);
+    void ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& result, BoundingBox& geometryBox, BoundingBox& shadowSpaceBox, bool getLitGeometries, bool GetShadowCasters);
     /// Check visibility of one shadow caster
     /// Check visibility of one shadow caster
     bool IsShadowCasterVisible(Drawable* drawable, BoundingBox lightViewBox, Camera* shadowCamera, const Matrix4x3& lightView, const Frustum& lightViewFrustum, const BoundingBox& lightViewFrustumBox);
     bool IsShadowCasterVisible(Drawable* drawable, BoundingBox lightViewBox, Camera* shadowCamera, const Matrix4x3& lightView, const Frustum& lightViewFrustum, const BoundingBox& lightViewFrustumBox);
     /// Set up initial shadow camera view
     /// Set up initial shadow camera view
@@ -234,21 +234,21 @@ private:
     /// Current split lights being processed
     /// Current split lights being processed
     Light* splitLights_[MAX_LIGHT_SPLITS];
     Light* splitLights_[MAX_LIGHT_SPLITS];
     /// Current lit geometries being processed
     /// Current lit geometries being processed
-    Vector<Drawable*> litGeometries_[MAX_LIGHT_SPLITS];
+    PODVector<Drawable*> litGeometries_[MAX_LIGHT_SPLITS];
     /// Current shadow casters being processed
     /// Current shadow casters being processed
-    Vector<Drawable*> shadowCasters_[MAX_LIGHT_SPLITS];
+    PODVector<Drawable*> shadowCasters_[MAX_LIGHT_SPLITS];
     /// Temporary drawable query result
     /// Temporary drawable query result
-    Vector<Drawable*> tempDrawables_;
+    PODVector<Drawable*> tempDrawables_;
     /// Geometry objects
     /// Geometry objects
-    Vector<Drawable*> geometries_;
+    PODVector<Drawable*> geometries_;
     /// Occluder objects
     /// Occluder objects
-    Vector<Drawable*> occluders_;
+    PODVector<Drawable*> occluders_;
     /// Directional light shadow rendering occluders
     /// Directional light shadow rendering occluders
-    Vector<Drawable*> shadowOccluders_;
+    PODVector<Drawable*> shadowOccluders_;
     /// Depth minimum and maximum values for visible geometries
     /// Depth minimum and maximum values for visible geometries
-    Vector<GeometryDepthBounds> geometryDepthBounds_;
+    PODVector<GeometryDepthBounds> geometryDepthBounds_;
     /// Lights
     /// Lights
-    Vector<Light*> lights_;
+    PODVector<Light*> lights_;
     /// G-buffer size error displayed
     /// G-buffer size error displayed
     Set<RenderSurface*> gBufferErrorDisplayed_;
     Set<RenderSurface*> gBufferErrorDisplayed_;
     
     

+ 2 - 2
Engine/IO/Deserializer.cpp

@@ -261,9 +261,9 @@ ShortStringHash Deserializer::ReadShortStringHash()
     return ret;
     return ret;
 }
 }
 
 
-Vector<unsigned char> Deserializer::ReadBuffer()
+PODVector<unsigned char> Deserializer::ReadBuffer()
 {
 {
-    Vector<unsigned char> ret;
+    PODVector<unsigned char> ret;
     
     
     ret.Resize(ReadVLE());
     ret.Resize(ReadVLE());
     if (ret.Size())
     if (ret.Size())

+ 1 - 1
Engine/IO/Deserializer.h

@@ -100,7 +100,7 @@ public:
     /// Read a 16-bit ShortStringHash
     /// Read a 16-bit ShortStringHash
     ShortStringHash ReadShortStringHash();
     ShortStringHash ReadShortStringHash();
     /// Read a buffer with size encoded as VLE
     /// Read a buffer with size encoded as VLE
-    Vector<unsigned char> ReadBuffer();
+    PODVector<unsigned char> ReadBuffer();
     /// Read a resource reference
     /// Read a resource reference
     ResourceRef ReadResourceRef();
     ResourceRef ReadResourceRef();
     /// Read a resource reference list
     /// Read a resource reference list

+ 0 - 2
Engine/IO/FileSystem.h

@@ -24,9 +24,7 @@
 #pragma once
 #pragma once
 
 
 #include "Object.h"
 #include "Object.h"
-
 #include "Set.h"
 #include "Set.h"
-#include "Vector.h"
 
 
 /// Return files
 /// Return files
 static const unsigned SCAN_FILES = 0x1;
 static const unsigned SCAN_FILES = 0x1;

+ 2 - 2
Engine/IO/MemoryBuffer.cpp

@@ -46,14 +46,14 @@ MemoryBuffer::MemoryBuffer(const void* data, unsigned size) :
         size_ = 0;
         size_ = 0;
 }
 }
 
 
-MemoryBuffer::MemoryBuffer(Vector<unsigned char>& data) :
+MemoryBuffer::MemoryBuffer(PODVector<unsigned char>& data) :
     Deserializer(data.Size()),
     Deserializer(data.Size()),
     buffer_(data.Size() ? &data[0] : 0),
     buffer_(data.Size() ? &data[0] : 0),
     readOnly_(false)
     readOnly_(false)
 {
 {
 }
 }
 
 
-MemoryBuffer::MemoryBuffer(const Vector<unsigned char>& data) :
+MemoryBuffer::MemoryBuffer(const PODVector<unsigned char>& data) :
     Deserializer(data.Size()),
     Deserializer(data.Size()),
     buffer_(data.Size() ? const_cast<unsigned char*>(&data[0]) : 0),
     buffer_(data.Size() ? const_cast<unsigned char*>(&data[0]) : 0),
     readOnly_(true)
     readOnly_(true)

+ 2 - 2
Engine/IO/MemoryBuffer.h

@@ -35,9 +35,9 @@ public:
     /// Construct as read-only with a pointer and size
     /// Construct as read-only with a pointer and size
     MemoryBuffer(const void* data, unsigned size);
     MemoryBuffer(const void* data, unsigned size);
     /// Construct from a vector, whuch must not go out of scope before MemoryBuffer
     /// Construct from a vector, whuch must not go out of scope before MemoryBuffer
-    MemoryBuffer(Vector<unsigned char>& data);
+    MemoryBuffer(PODVector<unsigned char>& data);
     /// Construct from a read-only vector, whuch must not go out of scope before MemoryBuffer
     /// Construct from a read-only vector, whuch must not go out of scope before MemoryBuffer
-    MemoryBuffer(const Vector<unsigned char>& data);
+    MemoryBuffer(const PODVector<unsigned char>& data);
     
     
     /// Read bytes from the memory area. Return number of bytes actually read
     /// Read bytes from the memory area. Return number of bytes actually read
     virtual unsigned Read(void* dest, unsigned size);
     virtual unsigned Read(void* dest, unsigned size);

+ 2 - 2
Engine/IO/Precompiled.h

@@ -23,8 +23,8 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
 #include "Set.h"
 #include "Set.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 1 - 1
Engine/IO/Serializer.cpp

@@ -173,7 +173,7 @@ bool Serializer::WriteShortStringHash(const ShortStringHash& value)
     return WriteUShort(value.GetValue());
     return WriteUShort(value.GetValue());
 }
 }
 
 
-bool Serializer::WriteBuffer(const Vector<unsigned char>& value)
+bool Serializer::WriteBuffer(const PODVector<unsigned char>& value)
 {
 {
     bool success = true;
     bool success = true;
     unsigned size = value.Size();
     unsigned size = value.Size();

+ 3 - 4
Engine/IO/Serializer.h

@@ -23,10 +23,9 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringHash.h"
-
 #include "Map.h"
 #include "Map.h"
-#include "Vector.h"
+#include "PODVector.h"
+#include "StringHash.h"
 
 
 class Color;
 class Color;
 class IntRect;
 class IntRect;
@@ -100,7 +99,7 @@ public:
     /// Write a 16-bit ShortStringHash
     /// Write a 16-bit ShortStringHash
     bool WriteShortStringHash(const ShortStringHash& value);
     bool WriteShortStringHash(const ShortStringHash& value);
     /// Write a buffer, with size encoded as VLE
     /// Write a buffer, with size encoded as VLE
-    bool WriteBuffer(const Vector<unsigned char>& buffer);
+    bool WriteBuffer(const PODVector<unsigned char>& buffer);
     /// Write a resource reference
     /// Write a resource reference
     bool WriteResourceRef(const ResourceRef& value);
     bool WriteResourceRef(const ResourceRef& value);
     /// Write a resource reference list
     /// Write a resource reference list

+ 2 - 2
Engine/IO/VectorBuffer.cpp

@@ -32,7 +32,7 @@ VectorBuffer::VectorBuffer()
 {
 {
 }
 }
 
 
-VectorBuffer::VectorBuffer(const Vector<unsigned char>& data)
+VectorBuffer::VectorBuffer(const PODVector<unsigned char>& data)
 {
 {
     SetData(data);
     SetData(data);
 }
 }
@@ -124,7 +124,7 @@ unsigned VectorBuffer::Write(const void* data, unsigned size)
     return size;
     return size;
 }
 }
 
 
-void VectorBuffer::SetData(const Vector<unsigned char>& data)
+void VectorBuffer::SetData(const PODVector<unsigned char>& data)
 {
 {
     buffer_ = data;
     buffer_ = data;
     position_ = 0;
     position_ = 0;

+ 5 - 7
Engine/IO/VectorBuffer.h

@@ -26,8 +26,6 @@
 #include "Deserializer.h"
 #include "Deserializer.h"
 #include "Serializer.h"
 #include "Serializer.h"
 
 
-#include "Vector.h"
-
 /// Dynamically sized buffer that can be read and written to as a stream
 /// Dynamically sized buffer that can be read and written to as a stream
 class VectorBuffer : public Deserializer, public Serializer
 class VectorBuffer : public Deserializer, public Serializer
 {
 {
@@ -35,7 +33,7 @@ public:
     /// Construct an empty buffer
     /// Construct an empty buffer
     VectorBuffer();
     VectorBuffer();
     /// Construct from another buffer
     /// Construct from another buffer
-    VectorBuffer(const Vector<unsigned char>& data);
+    VectorBuffer(const PODVector<unsigned char>& data);
     /// Construct from a memory area
     /// Construct from a memory area
     VectorBuffer(const void* data, unsigned size);
     VectorBuffer(const void* data, unsigned size);
     /// Construct from a stream
     /// Construct from a stream
@@ -49,7 +47,7 @@ public:
     virtual unsigned Write(const void* data, unsigned size);
     virtual unsigned Write(const void* data, unsigned size);
     
     
     /// Set data from another buffer
     /// Set data from another buffer
-    void SetData(const Vector<unsigned char>& data);
+    void SetData(const PODVector<unsigned char>& data);
     /// Set data from a memory area
     /// Set data from a memory area
     void SetData(const void* data, unsigned size);
     void SetData(const void* data, unsigned size);
     /// Set data from a stream
     /// Set data from a stream
@@ -64,9 +62,9 @@ public:
     /// Return non-const data
     /// Return non-const data
     unsigned char* GetModifiableData() { return size_ ? &buffer_[0] : 0; }
     unsigned char* GetModifiableData() { return size_ ? &buffer_[0] : 0; }
     /// Return the buffer
     /// Return the buffer
-    const Vector<unsigned char>& GetBuffer() const { return buffer_; }
+    const PODVector<unsigned char>& GetBuffer() const { return buffer_; }
     
     
 private:
 private:
-    /// Dynamic sized buffer
-    Vector<unsigned char> buffer_;
+    /// Dynamic data buffer
+    PODVector<unsigned char> buffer_;
 };
 };

+ 1 - 3
Engine/Network/Client.h

@@ -26,12 +26,10 @@
 #include "Controls.h"
 #include "Controls.h"
 #include "File.h"
 #include "File.h"
 #include "Object.h"
 #include "Object.h"
+#include "Set.h"
 #include "Timer.h"
 #include "Timer.h"
 #include "VectorBuffer.h"
 #include "VectorBuffer.h"
 
 
-#include "Map.h"
-#include "Set.h"
-
 class Connection;
 class Connection;
 class Network;
 class Network;
 class ResourceCache;
 class ResourceCache;

+ 4 - 2
Engine/Network/Precompiled.h

@@ -23,9 +23,11 @@
 
 
 #pragma once
 #pragma once
 
 
+#include "Map.h"
+#include "PODVector.h"
+#include "Set.h"
 #include "StringBase.h"
 #include "StringBase.h"
+#include "Vector.h"
 
 
 #include <cstdio>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdlib>
-#include "Map.h"
-#include "Vector.h"

+ 1 - 1
Engine/Network/ReplicationState.h

@@ -88,7 +88,7 @@ public:
     
     
 private:
 private:
     /// Revision information
     /// Revision information
-    Vector<Revision> revisions_;
+    PODVector<Revision> revisions_;
     
     
     /// Empty revision
     /// Empty revision
     static VectorBuffer emptyBaseRevision;
     static VectorBuffer emptyBaseRevision;

+ 0 - 2
Engine/Network/Server.cpp

@@ -35,8 +35,6 @@
 #include "Server.h"
 #include "Server.h"
 #include "StringUtils.h"
 #include "StringUtils.h"
 
 
-#include "Set.h"
-
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
 // Timeout for closing transferred package files, in milliseconds
 // Timeout for closing transferred package files, in milliseconds

+ 1 - 2
Engine/Network/Server.h

@@ -24,9 +24,8 @@
 #pragma once
 #pragma once
 
 
 #include "Object.h"
 #include "Object.h"
-#include "Timer.h"
-
 #include "Set.h"
 #include "Set.h"
+#include "Timer.h"
 
 
 class Connection;
 class Connection;
 class Network;
 class Network;

+ 4 - 4
Engine/Physics/PhysicsWorld.cpp

@@ -86,7 +86,7 @@ PhysicsWorld::PhysicsWorld(Context* context) :
     // Enable automatic resting of rigid bodies
     // Enable automatic resting of rigid bodies
     dWorldSetAutoDisableFlag(physicsWorld_, 1);
     dWorldSetAutoDisableFlag(physicsWorld_, 1);
     
     
-    contacts_ = new Vector<dContact>(maxContacts_);
+    contacts_ = new PODVector<dContact>(maxContacts_);
 }
 }
 
 
 PhysicsWorld::~PhysicsWorld()
 PhysicsWorld::~PhysicsWorld()
@@ -112,7 +112,7 @@ PhysicsWorld::~PhysicsWorld()
     }
     }
     if (contacts_)
     if (contacts_)
     {
     {
-        Vector<dContact>* contacts = static_cast<Vector<dContact>*>(contacts_);
+        PODVector<dContact>* contacts = static_cast<PODVector<dContact>*>(contacts_);
         delete contacts;
         delete contacts;
         contacts = 0;
         contacts = 0;
     }
     }
@@ -220,7 +220,7 @@ void PhysicsWorld::SetFps(int fps)
 void PhysicsWorld::SetMaxContacts(unsigned num)
 void PhysicsWorld::SetMaxContacts(unsigned num)
 {
 {
     maxContacts_ = Max(num, 1);
     maxContacts_ = Max(num, 1);
-    Vector<dContact>* contacts = static_cast<Vector<dContact>*>(contacts_);
+    PODVector<dContact>* contacts = static_cast<PODVector<dContact>*>(contacts_);
     contacts->Resize(maxContacts_);
     contacts->Resize(maxContacts_);
 }
 }
 
 
@@ -518,7 +518,7 @@ void PhysicsWorld::NearCallback(void *userData, dGeomID geomA, dGeomID geomB)
     float friction = (shapeA->GetFriction() + shapeB->GetFriction()) * 0.5f;
     float friction = (shapeA->GetFriction() + shapeB->GetFriction()) * 0.5f;
     float bounce = (shapeA->GetBounce() + shapeB->GetBounce()) * 0.5f;
     float bounce = (shapeA->GetBounce() + shapeB->GetBounce()) * 0.5f;
     
     
-    Vector<dContact>& contacts = *(static_cast<Vector<dContact>*>(world->contacts_));
+    PODVector<dContact>& contacts = *(static_cast<PODVector<dContact>*>(world->contacts_));
     
     
     for (unsigned i = 0; i < world->maxContacts_; ++i)
     for (unsigned i = 0; i < world->maxContacts_; ++i)
     {
     {

+ 2 - 3
Engine/Physics/PhysicsWorld.h

@@ -25,9 +25,8 @@
 
 
 #include "Component.h"
 #include "Component.h"
 #include "PhysicsDefs.h"
 #include "PhysicsDefs.h"
-#include "Vector3.h"
-
 #include "Set.h"
 #include "Set.h"
+#include "Vector3.h"
 
 
 class CollisionShape;
 class CollisionShape;
 class DebugRenderer;
 class DebugRenderer;
@@ -215,7 +214,7 @@ private:
     unsigned randomSeed_;
     unsigned randomSeed_;
     /// Rigid bodies
     /// Rigid bodies
     Vector<RigidBody*> rigidBodies_;
     Vector<RigidBody*> rigidBodies_;
-    /// Collision contacts (Vector<dContact>)
+    /// Collision contacts (PODVector<dContact>)
     void* contacts_;
     void* contacts_;
     /// Collision pairs on this frame
     /// Collision pairs on this frame
     Set<Pair<RigidBody*, RigidBody*> > currentCollisions_;
     Set<Pair<RigidBody*, RigidBody*> > currentCollisions_;

+ 4 - 2
Engine/Physics/Precompiled.h

@@ -23,9 +23,11 @@
 
 
 #pragma once
 #pragma once
 
 
+#include "Map.h"
+#include "PODVector.h"
 #include "StringBase.h"
 #include "StringBase.h"
+#include "Vector.h"
 
 
 #include <cstdio>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdlib>
-#include "Map.h"
-#include "Vector.h"
+

+ 0 - 2
Engine/Physics/RigidBody.h

@@ -26,8 +26,6 @@
 #include "Node.h"
 #include "Node.h"
 #include "PhysicsDefs.h"
 #include "PhysicsDefs.h"
 
 
-#include "Map.h"
-
 class DebugRenderer;
 class DebugRenderer;
 class PhysicsWorld;
 class PhysicsWorld;
 
 

+ 2 - 2
Engine/Resource/Precompiled.h

@@ -23,8 +23,8 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
 #include "Set.h"
 #include "Set.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 4 - 4
Engine/Resource/XMLElement.cpp

@@ -142,7 +142,7 @@ bool XMLElement::SetBuffer(const String& name, const void* data, unsigned size)
     return SetAttribute(name, dataStr);
     return SetAttribute(name, dataStr);
 }
 }
 
 
-bool XMLElement::SetBuffer(const String& name, const Vector<unsigned char>& value)
+bool XMLElement::SetBuffer(const String& name, const PODVector<unsigned char>& value)
 {
 {
     if (!value.Size())
     if (!value.Size())
         return SetAttribute(name, String());
         return SetAttribute(name, String());
@@ -434,9 +434,9 @@ BoundingBox XMLElement::GetBoundingBox() const
     return ret;
     return ret;
 }
 }
 
 
-Vector<unsigned char> XMLElement::GetBuffer(const String& name) const
+PODVector<unsigned char> XMLElement::GetBuffer(const String& name) const
 {
 {
-    Vector<unsigned char> ret;
+    PODVector<unsigned char> ret;
     Vector<String> bytes = Split(GetAttribute(name), ' ');
     Vector<String> bytes = Split(GetAttribute(name), ' ');
     
     
     ret.Resize(bytes.Size());
     ret.Resize(bytes.Size());
@@ -447,7 +447,7 @@ Vector<unsigned char> XMLElement::GetBuffer(const String& name) const
 
 
 bool XMLElement::GetBuffer(const String& name, void* dest, unsigned size) const
 bool XMLElement::GetBuffer(const String& name, void* dest, unsigned size) const
 {
 {
-    Vector<unsigned char> ret;
+    PODVector<unsigned char> ret;
     Vector<String> bytes = Split(GetAttribute(name), ' ');
     Vector<String> bytes = Split(GetAttribute(name), ' ');
     unsigned char* destBytes = (unsigned char*)dest;
     unsigned char* destBytes = (unsigned char*)dest;
     if (size < bytes.Size())
     if (size < bytes.Size())

+ 2 - 2
Engine/Resource/XMLElement.h

@@ -59,7 +59,7 @@ public:
     /// Set a buffer attribute
     /// Set a buffer attribute
     bool SetBuffer(const String& name, const void* data, unsigned size);
     bool SetBuffer(const String& name, const void* data, unsigned size);
     /// Set a buffer attribute
     /// Set a buffer attribute
-    bool SetBuffer(const String& name, const Vector<unsigned char>& value);
+    bool SetBuffer(const String& name, const PODVector<unsigned char>& value);
     /// Set a Color attribute
     /// Set a Color attribute
     bool SetColor(const String& name, const Color& value);
     bool SetColor(const String& name, const Color& value);
     /// Set a float attribute
     /// Set a float attribute
@@ -122,7 +122,7 @@ public:
     /// Return bool attribute, or false if missing
     /// Return bool attribute, or false if missing
     bool GetBool(const String& name) const;
     bool GetBool(const String& name) const;
     /// Return buffer attribute, or empty if missing
     /// Return buffer attribute, or empty if missing
-    Vector<unsigned char> GetBuffer(const String& name) const;
+    PODVector<unsigned char> GetBuffer(const String& name) const;
     /// Copy buffer attribute into a supplied buffer. Return false if not big enough
     /// Copy buffer attribute into a supplied buffer. Return false if not big enough
     bool GetBuffer(const String& name, void* dest, unsigned size) const;
     bool GetBuffer(const String& name, void* dest, unsigned size) const;
     /// Return bounding box attribute, or empty if missing
     /// Return bounding box attribute, or empty if missing

+ 0 - 2
Engine/Scene/Node.h

@@ -26,8 +26,6 @@
 #include "Matrix4x3.h"
 #include "Matrix4x3.h"
 #include "Serializable.h"
 #include "Serializable.h"
 
 
-#include "Vector.h"
-
 class Component;
 class Component;
 class Connection;
 class Connection;
 class Scene;
 class Scene;

+ 1 - 2
Engine/Scene/Precompiled.h

@@ -23,7 +23,6 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 2 - 2
Engine/Scene/Serializable.cpp

@@ -100,7 +100,7 @@ void Serializable::OnSetAttribute(const AttributeInfo& attr, const Variant& valu
         break;
         break;
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        *(reinterpret_cast<Vector<unsigned char>*>(dest)) = value.GetBuffer();
+        *(reinterpret_cast<PODVector<unsigned char>*>(dest)) = value.GetBuffer();
         break;
         break;
         
         
     case VAR_RESOURCEREF:
     case VAR_RESOURCEREF:
@@ -164,7 +164,7 @@ Variant Serializable::OnGetAttribute(const AttributeInfo& attr)
         return Variant(*(reinterpret_cast<const String*>(src)));
         return Variant(*(reinterpret_cast<const String*>(src)));
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        return Variant(*(reinterpret_cast<const Vector<unsigned char>*>(src)));
+        return Variant(*(reinterpret_cast<const PODVector<unsigned char>*>(src)));
         
         
     case VAR_RESOURCEREF:
     case VAR_RESOURCEREF:
         return Variant(*(reinterpret_cast<const ResourceRef*>(src)));
         return Variant(*(reinterpret_cast<const ResourceRef*>(src)));

+ 2 - 2
Engine/Script/Precompiled.h

@@ -23,7 +23,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 0 - 4
Engine/Script/ScriptFile.h

@@ -25,11 +25,7 @@
 
 
 #include "Resource.h"
 #include "Resource.h"
 #include "ScriptEventListener.h"
 #include "ScriptEventListener.h"
-#include "SharedPtr.h"
-#include "Variant.h"
-
 #include "Set.h"
 #include "Set.h"
-#include "Vector.h"
 
 
 class Script;
 class Script;
 class ScriptInstance;
 class ScriptInstance;

+ 5 - 5
Engine/Script/ScriptInstance.cpp

@@ -82,8 +82,8 @@ void ScriptInstance::RegisterObject(Context* context)
     ATTRIBUTE(ScriptInstance, VAR_BOOL, "Active", active_, true);
     ATTRIBUTE(ScriptInstance, VAR_BOOL, "Active", active_, true);
     ATTRIBUTE(ScriptInstance, VAR_INT, "Fixed Update FPS", fixedUpdateFps_, 0);
     ATTRIBUTE(ScriptInstance, VAR_INT, "Fixed Update FPS", fixedUpdateFps_, 0);
     ATTRIBUTE_MODE(ScriptInstance, VAR_FLOAT, "Time Accumulator", fixedUpdateAcc_, 0.0f, AM_SERIALIZATION);
     ATTRIBUTE_MODE(ScriptInstance, VAR_FLOAT, "Time Accumulator", fixedUpdateAcc_, 0.0f, AM_SERIALIZATION);
-    ATTRIBUTE_MODE(ScriptInstance, VAR_BUFFER, "Delayed Method Calls", delayedMethodCalls_, Vector<unsigned char>(), AM_SERIALIZATION);
-    ACCESSOR_ATTRIBUTE(ScriptInstance, VAR_BUFFER, "Script Data", GetScriptData, SetScriptData, Vector<unsigned char>, Vector<unsigned char>());
+    ATTRIBUTE_MODE(ScriptInstance, VAR_BUFFER, "Delayed Method Calls", delayedMethodCalls_, PODVector<unsigned char>(), AM_SERIALIZATION);
+    ACCESSOR_ATTRIBUTE(ScriptInstance, VAR_BUFFER, "Script Data", GetScriptData, SetScriptData, PODVector<unsigned char>, PODVector<unsigned char>());
 }
 }
 
 
 void ScriptInstance::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void ScriptInstance::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
@@ -376,10 +376,10 @@ void ScriptInstance::GetSupportedMethods()
     }
     }
 }
 }
 
 
-Vector<unsigned char> ScriptInstance::GetScriptData() const
+PODVector<unsigned char> ScriptInstance::GetScriptData() const
 {
 {
     if ((!scriptObject_) || (!methods_[METHOD_SAVE]))
     if ((!scriptObject_) || (!methods_[METHOD_SAVE]))
-        return Vector<unsigned char>();
+        return PODVector<unsigned char>();
     else
     else
     {
     {
         VectorBuffer buf;
         VectorBuffer buf;
@@ -390,7 +390,7 @@ Vector<unsigned char> ScriptInstance::GetScriptData() const
     }
     }
 }
 }
 
 
-void ScriptInstance::SetScriptData(Vector<unsigned char> data)
+void ScriptInstance::SetScriptData(PODVector<unsigned char> data)
 {
 {
     if ((scriptObject_) && (methods_[METHOD_LOAD]))
     if ((scriptObject_) && (methods_[METHOD_LOAD]))
     {
     {

+ 2 - 2
Engine/Script/ScriptInstance.h

@@ -121,9 +121,9 @@ private:
     /// Check for supported methods
     /// Check for supported methods
     void GetSupportedMethods();
     void GetSupportedMethods();
     /// Get script object's serialization data by calling a script function
     /// Get script object's serialization data by calling a script function
-    Vector<unsigned char> GetScriptData() const;
+    PODVector<unsigned char> GetScriptData() const;
     /// Set script object's serialization data by calling a script function
     /// Set script object's serialization data by calling a script function
-    void SetScriptData(Vector<unsigned char> data);
+    void SetScriptData(PODVector<unsigned char> data);
     /// Handle scene update event
     /// Handle scene update event
     void HandleSceneUpdate(StringHash eventType, VariantMap& eventData);
     void HandleSceneUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle scene post-update event
     /// Handle scene post-update event

+ 1 - 1
Engine/UI/Font.h

@@ -66,7 +66,7 @@ struct FontFace
     /// Glyph index mapping
     /// Glyph index mapping
     unsigned short glyphIndex_[MAX_FONT_CHARS];
     unsigned short glyphIndex_[MAX_FONT_CHARS];
     /// Glyphs
     /// Glyphs
-    Vector<FontGlyph> glyphs_;
+    PODVector<FontGlyph> glyphs_;
 };
 };
 
 
 /// Font resource
 /// Font resource

+ 0 - 1
Engine/UI/ListView.h

@@ -24,7 +24,6 @@
 #pragma once
 #pragma once
 
 
 #include "ScrollView.h"
 #include "ScrollView.h"
-
 #include "Set.h"
 #include "Set.h"
 
 
 /// ListView selection highlight mode
 /// ListView selection highlight mode

+ 2 - 2
Engine/UI/Precompiled.h

@@ -23,7 +23,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "StringBase.h"
-
 #include "Map.h"
 #include "Map.h"
+#include "PODVector.h"
+#include "StringBase.h"
 #include "Vector.h"
 #include "Vector.h"

+ 6 - 6
Tools/AssetImporter/AssetImporter.cpp

@@ -137,14 +137,14 @@ unsigned GetMeshIndex(aiMesh* mesh);
 unsigned GetBoneIndex(OutModel& model, const String& boneName);
 unsigned GetBoneIndex(OutModel& model, const String& boneName);
 aiBone* GetMeshBone(OutModel& model, const String& boneName);
 aiBone* GetMeshBone(OutModel& model, const String& boneName);
 Matrix4x3 GetOffsetMatrix(OutModel& model, const String& boneName);
 Matrix4x3 GetOffsetMatrix(OutModel& model, const String& boneName);
-void GetBlendData(OutModel& model, aiMesh* mesh, Vector<unsigned>& boneMappings, Vector<Vector<unsigned char> >&
+void GetBlendData(OutModel& model, aiMesh* mesh, Vector<unsigned>& boneMappings, Vector<PODVector<unsigned char> >&
     blendIndices, Vector<Vector<float> >& blendWeights);
     blendIndices, Vector<Vector<float> >& blendWeights);
 String GetMeshMaterialName(aiMesh* mesh);
 String GetMeshMaterialName(aiMesh* mesh);
 
 
 void WriteShortIndices(unsigned short*& dest, aiMesh* mesh, unsigned index, unsigned offset);
 void WriteShortIndices(unsigned short*& dest, aiMesh* mesh, unsigned index, unsigned offset);
 void WriteLargeIndices(unsigned*& dest, aiMesh* mesh, unsigned index, unsigned offset);
 void WriteLargeIndices(unsigned*& dest, aiMesh* mesh, unsigned index, unsigned offset);
 void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, unsigned elementMask, BoundingBox& box,
 void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, unsigned elementMask, BoundingBox& box,
-    const Matrix4x3& vertexTransform, const Matrix3& normalTransform, Vector<Vector<unsigned char> >& blendIndices,
+    const Matrix4x3& vertexTransform, const Matrix3& normalTransform, Vector<PODVector<unsigned char> >& blendIndices,
     Vector<Vector<float> >& blendWeights);
     Vector<Vector<float> >& blendWeights);
 unsigned GetElementMask(aiMesh* mesh);
 unsigned GetElementMask(aiMesh* mesh);
 
 
@@ -694,7 +694,7 @@ void BuildAndSaveModel(OutModel& model)
             
             
             // Build the vertex data
             // Build the vertex data
             // If there are bones, get blend data
             // If there are bones, get blend data
-            Vector<Vector<unsigned char> > blendIndices;
+            Vector<PODVector<unsigned char> > blendIndices;
             Vector<Vector<float> > blendWeights;
             Vector<Vector<float> > blendWeights;
             Vector<unsigned> boneMappings;
             Vector<unsigned> boneMappings;
             if (model.bones_.Size())
             if (model.bones_.Size())
@@ -768,7 +768,7 @@ void BuildAndSaveModel(OutModel& model)
             
             
             // Build the vertex data
             // Build the vertex data
             // If there are bones, get blend data
             // If there are bones, get blend data
-            Vector<Vector<unsigned char> > blendIndices;
+            Vector<PODVector<unsigned char> > blendIndices;
             Vector<Vector<float> > blendWeights;
             Vector<Vector<float> > blendWeights;
             Vector<unsigned> boneMappings;
             Vector<unsigned> boneMappings;
             if (model.bones_.Size())
             if (model.bones_.Size())
@@ -1404,7 +1404,7 @@ Matrix4x3 GetOffsetMatrix(OutModel& model, const String& boneName)
     return Matrix4x3::IDENTITY;
     return Matrix4x3::IDENTITY;
 }
 }
 
 
-void GetBlendData(OutModel& model, aiMesh* mesh, Vector<unsigned>& boneMappings, Vector<Vector<unsigned char> >&
+void GetBlendData(OutModel& model, aiMesh* mesh, Vector<unsigned>& boneMappings, Vector<PODVector<unsigned char> >&
     blendIndices, Vector<Vector<float> >& blendWeights)
     blendIndices, Vector<Vector<float> >& blendWeights)
 {
 {
     blendIndices.Resize(mesh->mNumVertices);
     blendIndices.Resize(mesh->mNumVertices);
@@ -1483,7 +1483,7 @@ void WriteLargeIndices(unsigned*& dest, aiMesh* mesh, unsigned index, unsigned o
 }
 }
 
 
 void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, unsigned elementMask, BoundingBox& box,
 void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, unsigned elementMask, BoundingBox& box,
-    const Matrix4x3& vertexTransform, const Matrix3& normalTransform, Vector<Vector<unsigned char> >& blendIndices,
+    const Matrix4x3& vertexTransform, const Matrix3& normalTransform, Vector<PODVector<unsigned char> >& blendIndices,
     Vector<Vector<float> >& blendWeights)
     Vector<Vector<float> >& blendWeights)
 {
 {
     Vector3 vertex = vertexTransform * ToVector3(mesh->mVertices[index]);
     Vector3 vertex = vertexTransform * ToVector3(mesh->mVertices[index]);

+ 6 - 8
Tools/OgreImporter/OgreImporter.cpp

@@ -26,13 +26,11 @@
 #include "FileSystem.h"
 #include "FileSystem.h"
 #include "OgreImporterUtils.h"
 #include "OgreImporterUtils.h"
 #include "ProcessUtils.h"
 #include "ProcessUtils.h"
+#include "Sort.h"
 #include "StringUtils.h"
 #include "StringUtils.h"
 #include "XMLFile.h"
 #include "XMLFile.h"
 
 
-#include "Sort.h"
 #include <cstring>
 #include <cstring>
-#include "Map.h"
-#include "Set.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
@@ -468,7 +466,7 @@ void LoadMesh(const String& inputFileName, bool generateTangents, bool splitSubM
                 {
                 {
                     Map<unsigned, unsigned> usedBoneMap;
                     Map<unsigned, unsigned> usedBoneMap;
                     unsigned remapIndex = 0;
                     unsigned remapIndex = 0;
-                    for (Map<unsigned, Vector<BoneWeightAssignment> >::Iterator i =
+                    for (Map<unsigned, PODVector<BoneWeightAssignment> >::Iterator i =
                         subGeometryLodLevel.boneWeights_.Begin(); i != subGeometryLodLevel.boneWeights_.End(); ++i)
                         subGeometryLodLevel.boneWeights_.Begin(); i != subGeometryLodLevel.boneWeights_.End(); ++i)
                     {
                     {
                         // Sort the bone assigns by weight
                         // Sort the bone assigns by weight
@@ -499,7 +497,7 @@ void LoadMesh(const String& inputFileName, bool generateTangents, bool splitSubM
                     sorted = true;
                     sorted = true;
                 }
                 }
                 
                 
-                for (Map<unsigned, Vector<BoneWeightAssignment> >::Iterator i = subGeometryLodLevel.boneWeights_.Begin();
+                for (Map<unsigned, PODVector<BoneWeightAssignment> >::Iterator i = subGeometryLodLevel.boneWeights_.Begin();
                     i != subGeometryLodLevel.boneWeights_.End(); ++i)
                     i != subGeometryLodLevel.boneWeights_.End(); ++i)
                 {
                 {
                     // Sort the bone assigns by weight, if not sorted yet in bone remapping pass
                     // Sort the bone assigns by weight, if not sorted yet in bone remapping pass
@@ -1058,8 +1056,8 @@ void WriteOutput(const String& outputFileName, bool exportAnimations, bool rotat
 
 
 void OptimizeIndices(ModelSubGeometryLodLevel* subGeom, ModelVertexBuffer* vb, ModelIndexBuffer* ib)
 void OptimizeIndices(ModelSubGeometryLodLevel* subGeom, ModelVertexBuffer* vb, ModelIndexBuffer* ib)
 {
 {
-    Vector<Triangle> oldTriangles;
-    Vector<Triangle> newTriangles;
+    PODVector<Triangle> oldTriangles;
+    PODVector<Triangle> newTriangles;
     
     
     for (unsigned i = 0; i < vb->vertices_.Size(); ++i)
     for (unsigned i = 0; i < vb->vertices_.Size(); ++i)
     {
     {
@@ -1085,7 +1083,7 @@ void OptimizeIndices(ModelSubGeometryLodLevel* subGeom, ModelVertexBuffer* vb, M
     for (unsigned i = 0; i < vb->vertices_.Size(); ++i)
     for (unsigned i = 0; i < vb->vertices_.Size(); ++i)
         CalculateScore(vb->vertices_[i]);
         CalculateScore(vb->vertices_[i]);
     
     
-    Vector<unsigned> vertexCache;
+    PODVector<unsigned> vertexCache;
     
     
     while (oldTriangles.Size())
     while (oldTriangles.Size())
     {
     {

+ 1 - 1
Tools/OgreImporter/OgreImporterUtils.h

@@ -217,7 +217,7 @@ struct ModelSubGeometryLodLevel
     unsigned indexBuffer_;
     unsigned indexBuffer_;
     unsigned indexStart_;
     unsigned indexStart_;
     unsigned indexCount_;
     unsigned indexCount_;
-    Map<unsigned, Vector<BoneWeightAssignment> > boneWeights_;
+    Map<unsigned, PODVector<BoneWeightAssignment> > boneWeights_;
     Vector<unsigned> boneMapping_;
     Vector<unsigned> boneMapping_;
     
     
     ModelSubGeometryLodLevel() : 
     ModelSubGeometryLodLevel() : 

+ 1 - 1
Tools/PackageTool/PackageTool.cpp

@@ -27,11 +27,11 @@
 #include "ProcessUtils.h"
 #include "ProcessUtils.h"
 #include "SharedArrayPtr.h"
 #include "SharedArrayPtr.h"
 #include "StringUtils.h"
 #include "StringUtils.h"
+#include "Vector.h"
 
 
 #include <cstdio>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdlib>
 #include <cstring>
 #include <cstring>
-#include "Vector.h"
 #include <Windows.h>
 #include <Windows.h>
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"

+ 3 - 3
Tools/ShaderCompiler/ShaderCompiler.cpp

@@ -682,7 +682,7 @@ bool Compile(ShaderType type, const String& input, const String& output, const V
                         {
                         {
                             unsigned oldIndex = textureUnits_[name];
                             unsigned oldIndex = textureUnits_[name];
                             if (oldIndex != index)
                             if (oldIndex != index)
-                                ErrorExit("Texture " + name + " bound to several sampler Registers");
+                                ErrorExit("Texture " + name + " bound to several sampler registers");
                         }
                         }
                         textureUnits_[name] = index;
                         textureUnits_[name] = index;
                     }
                     }
@@ -697,7 +697,7 @@ bool Compile(ShaderType type, const String& input, const String& output, const V
                         {
                         {
                             unsigned oldIndex = vsParams_[name];
                             unsigned oldIndex = vsParams_[name];
                             if (oldIndex != index)
                             if (oldIndex != index)
-                                ErrorExit("Parameter " + name + " bound to several constant Registers");
+                                ErrorExit("Parameter " + name + " bound to several constant registers");
                         }
                         }
                         vsParams_[name] = index;
                         vsParams_[name] = index;
                     }
                     }
@@ -709,7 +709,7 @@ bool Compile(ShaderType type, const String& input, const String& output, const V
                         {
                         {
                             unsigned oldIndex = psParams_[name];
                             unsigned oldIndex = psParams_[name];
                             if (oldIndex != index)
                             if (oldIndex != index)
-                                ErrorExit("Parameter " + name + " bound to several constant Registers");
+                                ErrorExit("Parameter " + name + " bound to several constant registers");
                         }
                         }
                         psParams_[name] = index;
                         psParams_[name] = index;
                     }
                     }