Browse Source

Container library fixes.
Replaced std::vector with Vector or PODVector as appropriate.
Replaced std::map & std::set with Map & Set.

Lasse Öörni 14 years ago
parent
commit
d69efd65f0
100 changed files with 1656 additions and 1498 deletions
  1. 6 6
      Engine/Audio/Audio.cpp
  2. 3 3
      Engine/Audio/Audio.h
  3. 3 3
      Engine/Audio/Precompiled.h
  4. 1 1
      Engine/Audio/Sound.h
  5. 20 20
      Engine/Audio/SoundSource.cpp
  6. 47 25
      Engine/Container/Iterator.h
  7. 8 3
      Engine/Container/ListBase.h
  8. 55 19
      Engine/Container/Map.h
  9. 7 3
      Engine/Container/PODVector.h
  10. 24 2
      Engine/Container/Pair.h
  11. 46 12
      Engine/Container/Set.h
  12. 20 19
      Engine/Container/Sort.h
  13. 1 1
      Engine/Container/String.cpp
  14. 8 4
      Engine/Container/Vector.h
  15. 41 41
      Engine/Core/Context.cpp
  16. 40 40
      Engine/Core/Context.h
  17. 4 0
      Engine/Core/DebugNew.h
  18. 65 65
      Engine/Core/Object.cpp
  19. 1 1
      Engine/Core/Object.h
  20. 3 3
      Engine/Core/Precompiled.h
  21. 8 8
      Engine/Core/ProcessUtils.cpp
  22. 3 3
      Engine/Core/ProcessUtils.h
  23. 2 2
      Engine/Core/Profiler.cpp
  24. 7 7
      Engine/Core/Profiler.h
  25. 6 2
      Engine/Core/SharedArrayPtr.h
  26. 4 0
      Engine/Core/SharedPtr.h
  27. 23 23
      Engine/Core/StringUtils.cpp
  28. 2 2
      Engine/Core/StringUtils.h
  29. 22 22
      Engine/Core/Variant.cpp
  30. 15 15
      Engine/Core/Variant.h
  31. 31 31
      Engine/Engine/APITemplates.h
  32. 16 16
      Engine/Engine/Console.cpp
  33. 3 3
      Engine/Engine/Console.h
  34. 13 13
      Engine/Engine/CoreAPI.cpp
  35. 8 8
      Engine/Engine/Engine.cpp
  36. 2 2
      Engine/Engine/Engine.h
  37. 13 13
      Engine/Engine/GraphicsAPI.cpp
  38. 2 2
      Engine/Engine/IOAPI.cpp
  39. 1 1
      Engine/Engine/PhysicsAPI.cpp
  40. 2 2
      Engine/Engine/Precompiled.h
  41. 9 9
      Engine/Engine/ScriptAPI.cpp
  42. 6 6
      Engine/Engine/UIAPI.cpp
  43. 102 103
      Engine/Graphics/AnimatedModel.cpp
  44. 13 13
      Engine/Graphics/AnimatedModel.h
  45. 15 15
      Engine/Graphics/Animation.cpp
  46. 4 4
      Engine/Graphics/Animation.h
  47. 16 16
      Engine/Graphics/AnimationController.cpp
  48. 1 1
      Engine/Graphics/AnimationController.h
  49. 18 18
      Engine/Graphics/AnimationState.cpp
  50. 3 3
      Engine/Graphics/AnimationState.h
  51. 63 64
      Engine/Graphics/Batch.cpp
  52. 18 7
      Engine/Graphics/Batch.h
  53. 14 15
      Engine/Graphics/BillboardSet.cpp
  54. 4 4
      Engine/Graphics/BillboardSet.h
  55. 55 55
      Engine/Graphics/DebugRenderer.cpp
  56. 3 3
      Engine/Graphics/DebugRenderer.h
  57. 12 17
      Engine/Graphics/Drawable.cpp
  58. 7 3
      Engine/Graphics/Drawable.h
  59. 10 10
      Engine/Graphics/Geometry.cpp
  60. 5 5
      Engine/Graphics/Geometry.h
  61. 54 54
      Engine/Graphics/Graphics.cpp
  62. 11 11
      Engine/Graphics/Graphics.h
  63. 25 25
      Engine/Graphics/Material.cpp
  64. 9 9
      Engine/Graphics/Material.h
  65. 62 62
      Engine/Graphics/Model.cpp
  66. 15 15
      Engine/Graphics/Model.h
  67. 6 6
      Engine/Graphics/OcclusionBuffer.cpp
  68. 2 2
      Engine/Graphics/OcclusionBuffer.h
  69. 21 21
      Engine/Graphics/Octree.cpp
  70. 7 7
      Engine/Graphics/Octree.h
  71. 10 10
      Engine/Graphics/OctreeQuery.h
  72. 24 24
      Engine/Graphics/ParticleEmitter.cpp
  73. 5 5
      Engine/Graphics/ParticleEmitter.h
  74. 4 4
      Engine/Graphics/Precompiled.h
  75. 78 78
      Engine/Graphics/Renderer.cpp
  76. 16 16
      Engine/Graphics/Renderer.h
  77. 9 9
      Engine/Graphics/Skeleton.cpp
  78. 4 4
      Engine/Graphics/Skeleton.h
  79. 22 22
      Engine/Graphics/StaticModel.cpp
  80. 4 4
      Engine/Graphics/StaticModel.h
  81. 6 6
      Engine/Graphics/Technique.cpp
  82. 10 10
      Engine/Graphics/Technique.h
  83. 13 13
      Engine/Graphics/VertexDeclaration.cpp
  84. 4 4
      Engine/Graphics/VertexDeclaration.h
  85. 109 109
      Engine/Graphics/View.cpp
  86. 31 21
      Engine/Graphics/View.h
  87. 9 9
      Engine/IO/Deserializer.cpp
  88. 1 1
      Engine/IO/Deserializer.h
  89. 18 17
      Engine/IO/FileSystem.cpp
  90. 6 6
      Engine/IO/FileSystem.h
  91. 6 6
      Engine/IO/MemoryBuffer.cpp
  92. 2 2
      Engine/IO/MemoryBuffer.h
  93. 4 4
      Engine/IO/PackageFile.cpp
  94. 3 3
      Engine/IO/PackageFile.h
  95. 3 3
      Engine/IO/Precompiled.h
  96. 10 10
      Engine/IO/Serializer.cpp
  97. 5 5
      Engine/IO/Serializer.h
  98. 9 9
      Engine/IO/VectorBuffer.cpp
  99. 5 5
      Engine/IO/VectorBuffer.h
  100. 50 50
      Engine/Network/Client.cpp

+ 6 - 6
Engine/Audio/Audio.cpp

@@ -190,7 +190,7 @@ void Audio::Update(float timeStep)
     MutexLock Lock(audioMutex_);
     MutexLock Lock(audioMutex_);
     
     
     // Update in reverse order, because sound sources might remove themselves
     // Update in reverse order, because sound sources might remove themselves
-    for (unsigned i = soundSources_.size() - 1; i < soundSources_.size(); --i)
+    for (unsigned i = soundSources_.Size() - 1; i < soundSources_.Size(); --i)
         soundSources_[i]->Update(timeStep);
         soundSources_[i]->Update(timeStep);
 }
 }
 
 
@@ -263,7 +263,7 @@ void Audio::SetListenerTransform(const Vector3& position, const Quaternion& rota
 
 
 void Audio::StopSound(Sound* soundClip)
 void Audio::StopSound(Sound* soundClip)
 {
 {
-    for (std::vector<SoundSource*>::iterator i = soundSources_.begin(); i != soundSources_.end(); ++i)
+    for (Vector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
     {
     {
         if ((*i)->GetSound() == soundClip)
         if ((*i)->GetSound() == soundClip)
             (*i)->Stop();
             (*i)->Stop();
@@ -287,18 +287,18 @@ void Audio::AddSoundSource(SoundSource* channel)
 {
 {
     MutexLock Lock(audioMutex_);
     MutexLock Lock(audioMutex_);
     
     
-    soundSources_.push_back(channel);
+    soundSources_.Push(channel);
 }
 }
 
 
 void Audio::RemoveSoundSource(SoundSource* channel)
 void Audio::RemoveSoundSource(SoundSource* channel)
 {
 {
     MutexLock Lock(audioMutex_);
     MutexLock Lock(audioMutex_);
     
     
-    for (std::vector<SoundSource*>::iterator i = soundSources_.begin(); i != soundSources_.end(); ++i)
+    for (Vector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
     {
     {
         if (*i == channel)
         if (*i == channel)
         {
         {
-            soundSources_.erase(i);
+            soundSources_.Erase(i);
             return;
             return;
         }
         }
     }
     }
@@ -399,7 +399,7 @@ void Audio::MixOutput(void *dest, unsigned bytes)
     int* clipPtr = clipBuffer_.GetPtr();
     int* clipPtr = clipBuffer_.GetPtr();
     
     
     // Mix samples to clip buffer
     // Mix samples to clip buffer
-    for (std::vector<SoundSource*>::iterator i = soundSources_.begin(); i != soundSources_.end(); ++i)
+    for (Vector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
         (*i)->Mix(clipPtr, mixSamples, mixRate_, stereo_, interpolate_);
         (*i)->Mix(clipPtr, mixSamples, mixRate_, stereo_, interpolate_);
     
     
     // Copy output from clip buffer to destination
     // Copy output from clip buffer to destination

+ 3 - 3
Engine/Audio/Audio.h

@@ -30,7 +30,7 @@
 #include "Thread.h"
 #include "Thread.h"
 #include "SharedArrayPtr.h"
 #include "SharedArrayPtr.h"
 
 
-#include <vector>
+#include "Vector.h"
 
 
 class AudioImpl;
 class AudioImpl;
 class Sound;
 class Sound;
@@ -93,7 +93,7 @@ public:
     /// Return listener rotation
     /// Return listener rotation
     const Quaternion& GetListenerRotation() const { return listenerRotation_; }
     const Quaternion& GetListenerRotation() const { return listenerRotation_; }
     /// Return all sound sources
     /// Return all sound sources
-    const std::vector<SoundSource*>& GetSoundSources() const { return soundSources_; }
+    const Vector<SoundSource*>& GetSoundSources() const { return soundSources_; }
     
     
     /// Add a sound source to keep track of. Called by SoundSource
     /// Add a sound source to keep track of. Called by SoundSource
     void AddSoundSource(SoundSource* soundSource);
     void AddSoundSource(SoundSource* soundSource);
@@ -146,7 +146,7 @@ private:
     /// Master gain by sound source type
     /// Master gain by sound source type
     float masterGain_[MAX_SOUND_TYPES];
     float masterGain_[MAX_SOUND_TYPES];
     /// Sound sources
     /// Sound sources
-    std::vector<SoundSource*> soundSources_;
+    Vector<SoundSource*> soundSources_;
     /// Listener position
     /// Listener position
     Vector3 listenerPosition_;
     Vector3 listenerPosition_;
     /// Listener rotation
     /// Listener rotation

+ 3 - 3
Engine/Audio/Precompiled.h

@@ -25,6 +25,6 @@
 
 
 #include "StringBase.h"
 #include "StringBase.h"
 
 
-#include <map>
-#include <set>
-#include <vector>
+#include "Map.h"
+#include "Set.h"
+#include "Vector.h"

+ 1 - 1
Engine/Audio/Sound.h

@@ -75,7 +75,7 @@ public:
     /// Return loop start
     /// Return loop start
     signed char* GetRepeat() const { return repeat_; }
     signed char* GetRepeat() const { return repeat_; }
     /// Return sound data end
     /// Return sound data end
-    signed char* Getend() const { return end_; }
+    signed char* GetEnd() const { return end_; }
     /// Return length in seconds
     /// Return length in seconds
     float GetLength() const;
     float GetLength() const;
     /// Return total sound data size
     /// Return total sound data size

+ 20 - 20
Engine/Audio/SoundSource.cpp

@@ -349,7 +349,7 @@ void SoundSource::SetPlayPositionLockless(signed char* pos)
         return;
         return;
     
     
     signed char* start = sound_->GetStart();
     signed char* start = sound_->GetStart();
-    signed char* end = sound_->Getend();
+    signed char* end = sound_->GetEnd();
     if (pos < start)
     if (pos < start)
         pos = start;
         pos = start;
     if ((sound_->IsSixteenBit()) && ((pos - start) & 1))
     if ((sound_->IsSixteenBit()) && ((pos - start) & 1))
@@ -542,7 +542,7 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -569,7 +569,7 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -616,7 +616,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -647,7 +647,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -697,7 +697,7 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -724,7 +724,7 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -771,7 +771,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -804,7 +804,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -856,7 +856,7 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -885,7 +885,7 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -933,7 +933,7 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -964,7 +964,7 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -1014,7 +1014,7 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -1043,7 +1043,7 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -1091,7 +1091,7 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
     if (sound->IsSixteenBit())
     if (sound->IsSixteenBit())
     {
     {
         short* pos = (short*)position_;
         short* pos = (short*)position_;
-        short* end = (short*)sound->Getend();
+        short* end = (short*)sound->GetEnd();
         short* repeat = (short*)sound->GetRepeat();
         short* repeat = (short*)sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -1122,7 +1122,7 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
     else
     else
     {
     {
         signed char* pos = (signed char*)position_;
         signed char* pos = (signed char*)position_;
-        signed char* end = sound->Getend();
+        signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         signed char* repeat = sound->GetRepeat();
         
         
         if (sound->IsLooped())
         if (sound->IsLooped())
@@ -1169,13 +1169,13 @@ void SoundSource::MixZeroVolume(Sound* sound, unsigned samples, int mixRate)
     }
     }
     position_ += intAdd * sampleSize;
     position_ += intAdd * sampleSize;
     
     
-    if (position_ > sound->Getend())
+    if (position_ > sound->GetEnd())
     {
     {
         if (sound->IsLooped())
         if (sound->IsLooped())
         {
         {
-            while (position_ >= sound->Getend())
+            while (position_ >= sound->GetEnd())
             {
             {
-                position_ -= (sound->Getend() - sound->GetRepeat());
+                position_ -= (sound->GetEnd() - sound->GetRepeat());
             }
             }
         }
         }
         else
         else

+ 47 - 25
Engine/Container/Iterator.h

@@ -26,6 +26,8 @@
 /// Random access iterator
 /// Random access iterator
 template <class T> class RandomAccessIterator
 template <class T> class RandomAccessIterator
 {
 {
+    template <class T> friend class RandomAccessConstIterator;
+    
 public:
 public:
     /// Construct
     /// Construct
     explicit RandomAccessIterator(T* ptr) :
     explicit RandomAccessIterator(T* ptr) :
@@ -37,28 +39,34 @@ public:
     T* operator -> () const { return ptr_; }
     T* operator -> () const { return ptr_; }
     /// Dereference the object
     /// Dereference the object
     T& operator * () const { return *ptr_; }
     T& operator * () const { return *ptr_; }
-    /// Convert to a raw pointer
-    operator T* () const { return ptr_; }
-    /// Increment the pointer
-    void operator ++ () { ++ptr_; }
-    /// Decrement the pointer
-    void operator -- () { --ptr_; }
+    /// Preincrement the pointer
+    RandomAccessIterator<T>& operator ++ () { ++ptr_; return *this; }
+    /// Postincrement the pointer
+    RandomAccessIterator<T> operator ++ (int) { RandomAccessIterator<T> it = *this; ++ptr_; return it; }
+    /// Predecrement the pointer
+    RandomAccessIterator<T>& operator -- () { --ptr_; return *this; }
+    /// Postdecrement the pointer
+    RandomAccessIterator<T> operator -- (int) { RandomAccessIterator<T> it = *this; --ptr_; return it; }
     /// Add an offset to the pointer
     /// Add an offset to the pointer
-    void operator += (unsigned value) { ptr_ += value; }
+    RandomAccessIterator<T>& operator += (int value) { ptr_ += value; return *this; }
     /// Subtract an offset from the pointer
     /// Subtract an offset from the pointer
-    void operator -= (unsigned value) { ptr_ -= value; }
+    RandomAccessIterator<T>& operator -= (int value) { ptr_ -= value; return *this; }
     /// Add an offset to the pointer
     /// Add an offset to the pointer
-    RandomAccessIterator operator + (unsigned value) { return RandomAccessIterator(ptr_ + value); }
+    RandomAccessIterator<T> operator + (int value) const { return RandomAccessIterator<T>(ptr_ + value); }
     /// Subtract an offset from the pointer
     /// Subtract an offset from the pointer
-    RandomAccessIterator operator - (unsigned value) { return RandomAccessIterator(ptr_ - value); }
+    RandomAccessIterator<T> operator - (int value) const { return RandomAccessIterator<T>(ptr_ - value); }
     /// Calculate offset to another iterator
     /// Calculate offset to another iterator
     int operator - (const RandomAccessIterator& rhs) const { return ptr_ - rhs.ptr_; }
     int operator - (const RandomAccessIterator& rhs) const { return ptr_ - rhs.ptr_; }
     /// Test for equality with another iterator
     /// Test for equality with another iterator
     bool operator == (const RandomAccessIterator& rhs) const { return ptr_ == rhs.ptr_; }
     bool operator == (const RandomAccessIterator& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another iterator
     /// Test for inequality with another iterator
     bool operator != (const RandomAccessIterator& rhs) const { return ptr_ != rhs.ptr_; }
     bool operator != (const RandomAccessIterator& rhs) const { return ptr_ != rhs.ptr_; }
-    
-private:
+    /// Test for less than with another iterator
+    bool operator < (const RandomAccessIterator& rhs) const { return ptr_ < rhs.ptr_; }
+    /// Test for greater than with another iterator
+    bool operator > (const RandomAccessIterator& rhs) const { return ptr_ > rhs.ptr_; }
+
+protected:
     /// Pointer
     /// Pointer
     T* ptr_;
     T* ptr_;
 };
 };
@@ -68,37 +76,51 @@ template <class T> class RandomAccessConstIterator
 {
 {
 public:
 public:
     /// Construct
     /// Construct
-    explicit RandomAccessConstIterator(const T* ptr) :
+    explicit RandomAccessConstIterator(T* ptr) :
         ptr_(ptr)
         ptr_(ptr)
     {
     {
     }
     }
     
     
+    /// Construct from a non-const iterator
+    RandomAccessConstIterator(const RandomAccessIterator<T>& rhs) :
+        ptr_(rhs.ptr_)
+    {
+    }
+    
+    /// Assign from a non-const iterator
+    RandomAccessConstIterator<T>& operator = (const RandomAccessIterator<T>& rhs) { ptr_ = rhs.ptr_; return *this; }
     /// Point to the object
     /// Point to the object
     const T* operator -> () const { return ptr_; }
     const T* operator -> () const { return ptr_; }
     /// Dereference the object
     /// Dereference the object
     const T& operator * () const { return *ptr_; }
     const T& operator * () const { return *ptr_; }
-    /// Convert to a raw pointer
-    operator const T* () const { return ptr_; }
-    /// Increment the pointer
-    void operator ++ () { ++ptr_; }
-    /// Decrement the pointer
-    void operator -- () { --ptr_; }
+    /// Preincrement the pointer
+    RandomAccessConstIterator<T>& operator ++ () { ++ptr_; return *this; }
+    /// Postincrement the pointer
+    RandomAccessConstIterator<T> operator ++ (int) { RandomAccessConstIterator<T> it = *this; ++ptr_; return it; }
+    /// Predecrement the pointer
+    RandomAccessConstIterator<T>& operator -- () { --ptr_; return *this; }
+    /// Postdecrement the pointer
+    RandomAccessConstIterator<T> operator -- (int) { RandomAccessConstIterator<T> it = *this; --ptr_; return it; }
     /// Add an offset to the pointer
     /// Add an offset to the pointer
-    void operator += (unsigned value) { ptr_ += value; }
+    RandomAccessConstIterator<T>& operator += (int value) { ptr_ += value; return *this; }
     /// Subtract an offset from the pointer
     /// Subtract an offset from the pointer
-    void operator -= (unsigned value) { ptr_ -= value; }
+    RandomAccessConstIterator<T>& operator -= (int value) { ptr_ -= value; return *this; }
     /// Add an offset to the pointer
     /// Add an offset to the pointer
-    RandomAccessConstIterator operator + (unsigned value) { return RandomAccessConstIterator(ptr_ + value); }
+    RandomAccessConstIterator<T> operator + (int value) const { return RandomAccessConstIterator<T>(ptr_ + value); }
     /// Subtract an offset from the pointer
     /// Subtract an offset from the pointer
-    RandomAccessConstIterator operator - (unsigned value) { return RandomAccessConstIterator(ptr_ - value); }
+    RandomAccessConstIterator<T> operator - (int value) const { return RandomAccessConstIterator<T>(ptr_ - value); }
     /// Calculate offset to another iterator
     /// Calculate offset to another iterator
     int operator - (const RandomAccessConstIterator& rhs) const { return ptr_ - rhs.ptr_; }
     int operator - (const RandomAccessConstIterator& rhs) const { return ptr_ - rhs.ptr_; }
     /// Test for equality with another iterator
     /// Test for equality with another iterator
     bool operator == (const RandomAccessConstIterator& rhs) const { return ptr_ == rhs.ptr_; }
     bool operator == (const RandomAccessConstIterator& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another iterator
     /// Test for inequality with another iterator
     bool operator != (const RandomAccessConstIterator& rhs) const { return ptr_ != rhs.ptr_; }
     bool operator != (const RandomAccessConstIterator& rhs) const { return ptr_ != rhs.ptr_; }
+    /// Test for less than with another iterator
+    bool operator < (const RandomAccessConstIterator& rhs) const { return ptr_ < rhs.ptr_; }
+    /// Test for greater than with another iterator
+    bool operator > (const RandomAccessConstIterator& rhs) const { return ptr_ > rhs.ptr_; }
     
     
-private:
+protected:
     /// Pointer
     /// Pointer
-    const T* ptr_;
+    T* ptr_;
 };
 };

+ 8 - 3
Engine/Container/ListBase.h

@@ -46,26 +46,31 @@ struct ListNodeBase
 class ListIteratorBase
 class ListIteratorBase
 {
 {
 public:
 public:
+    explicit ListIteratorBase(ListNodeBase* ptr) :
+        ptr_(ptr)
+    {
+    }
+    
     /// Test for equality with another iterator
     /// Test for equality with another iterator
     bool operator == (const ListIteratorBase& rhs) const { return ptr_ == rhs.ptr_; }
     bool operator == (const ListIteratorBase& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another iterator
     /// Test for inequality with another iterator
     bool operator != (const ListIteratorBase& rhs) const { return ptr_ != rhs.ptr_; }
     bool operator != (const ListIteratorBase& rhs) const { return ptr_ != rhs.ptr_; }
     
     
+protected:
     /// Go to the next node
     /// Go to the next node
-    void operator ++ ()
+    void GotoNext()
     {
     {
         if (ptr_->next_)
         if (ptr_->next_)
             ptr_ = ptr_->next_;
             ptr_ = ptr_->next_;
     }
     }
     
     
     /// Go to the previous node
     /// Go to the previous node
-    void operator -- ()
+    void GotoPrev()
     {
     {
         if (ptr_->prev_)
         if (ptr_->prev_)
             ptr_ = ptr_->prev_;
             ptr_ = ptr_->prev_;
     }
     }
     
     
-protected:
     /// Node pointer
     /// Node pointer
     ListNodeBase* ptr_;
     ListNodeBase* ptr_;
 };
 };

+ 55 - 19
Engine/Container/Map.h

@@ -52,9 +52,9 @@ public:
         }
         }
         
         
         /// Test for equality with another pair
         /// Test for equality with another pair
-        bool operator == (const Pair<T, U>& rhs) { return (first_ == rhs.first_) && (second_ == rhs.second_); }
+        bool operator == (const KeyValue& rhs) const { return (first_ == rhs.first_) && (second_ == rhs.second_); }
         /// Test for inequality with another pair
         /// Test for inequality with another pair
-        bool operator != (const Pair<T, U>& rhs) { return (first_ != rhs.first_) || (second_ != rhs.second_); }
+        bool operator != (const KeyValue& rhs) const { return (first_ != rhs.first_) || (second_ != rhs.second_); }
         
         
         const T first_;
         const T first_;
         U second_;
         U second_;
@@ -82,31 +82,61 @@ public:
     /// Map node iterator
     /// Map node iterator
     class Iterator : public ListIteratorBase
     class Iterator : public ListIteratorBase
     {
     {
+        friend class ConstIterator;
+        
     public:
     public:
+        /// Construct
         explicit Iterator(Node* ptr) :
         explicit Iterator(Node* ptr) :
-            ptr_(ptr)
+            ListIteratorBase(ptr)
         {
         {
         }
         }
         
         
+        /// Preincrement the pointer
+        Iterator& operator ++ () { GotoNext(); return *this; }
+        /// Postincrement the pointer
+        Iterator operator ++ (int) { Iterator it = *this; GotoNext(); return it; }
+        /// Predecrement the pointer
+        Iterator& operator -- () { GotoPrev(); return *this; }
+        /// Postdecrement the pointer
+        Iterator operator -- (int) { Iterator it = *this; GotoPrev(); return it; }
+        
         /// Point to the pair
         /// Point to the pair
-        T* operator -> () const { return &(static_cast<Node*>(ptr_))->pair_; }
+        KeyValue* operator -> () const { return &(static_cast<Node*>(ptr_))->pair_; }
         /// Dereference the pair
         /// Dereference the pair
-        T& operator * () const { return (static_cast<Node*>(ptr_))->pair_; }
+        KeyValue& operator * () const { return (static_cast<Node*>(ptr_))->pair_; }
     };
     };
     
     
-    /// Map node const iterator
+    /// Set node const iterator
     class ConstIterator : public ListIteratorBase
     class ConstIterator : public ListIteratorBase
     {
     {
     public:
     public:
+        /// Construct
         explicit ConstIterator(Node* ptr) :
         explicit ConstIterator(Node* ptr) :
-            ptr_(ptr)
+            ListIteratorBase(ptr)
         {
         {
         }
         }
         
         
+        /// Construct from a non-const iterator
+        ConstIterator(const Iterator& rhs) :
+            ListIteratorBase(rhs.ptr_)
+        {
+        }
+        
+        /// Assign from a non-const iterator
+        ConstIterator& operator = (const Iterator& rhs) { ptr_ = rhs.ptr_; return *this; }
+        /// Preincrement the pointer
+        ConstIterator& operator ++ () { GotoNext(); return *this; }
+        /// Postincrement the pointer
+        ConstIterator operator ++ (int) { Iterator it = *this; GotoNext(); return it; }
+        /// Predecrement the pointer
+        ConstIterator& operator -- () { GotoPrev(); return *this; }
+        /// Postdecrement the pointer
+        ConstIterator operator -- (int) { Iterator it = *this; GotoPrev(); return it; }
+        
         /// Point to the pair
         /// Point to the pair
-        const T* operator -> () const { return &(static_cast<Node*>(ptr_))->pair_; }
+        const KeyValue* operator -> () const { return &(static_cast<Node*>(ptr_))->pair_; }
         /// Dereference the pair
         /// Dereference the pair
-        const T& operator * () const { return (static_cast<Node*>(ptr_))->pair_; }
+        const KeyValue& operator * () const { return (static_cast<Node*>(ptr_))->pair_; }
     };
     };
     
     
     /// Construct empty
     /// Construct empty
@@ -130,10 +160,7 @@ public:
     
     
     /// Construct from another map
     /// Construct from another map
     Map(const Map<T, U>& map) :
     Map(const Map<T, U>& map) :
-        maxHeight_(map.maxHeight_),
-        height_(0),
-        size_(0),
-        bitsLeft_(0)
+        SkipListBase(map.maxHeight_)
     {
     {
         // Allocate the head and tail nodes and zero the next pointers
         // Allocate the head and tail nodes and zero the next pointers
         head_ = AllocateNode(maxHeight_, T());
         head_ = AllocateNode(maxHeight_, T());
@@ -169,7 +196,7 @@ public:
         
         
         // Insert the nodes with same heights
         // Insert the nodes with same heights
         for (Node* i = rhs.GetHead()->GetNext(0); i != rhs.GetTail(); i = i->GetNext(0))
         for (Node* i = rhs.GetHead()->GetNext(0); i != rhs.GetTail(); i = i->GetNext(0))
-            InsertNode(i->pair_, i->height_);
+            InsertNode(Pair<T, U>(i->pair_.first_, i->pair_.second_), i->height_);
         
         
         return *this;
         return *this;
     }
     }
@@ -320,9 +347,9 @@ public:
     }
     }
     
     
     /// Erase by an iterator. Return an iterator to the next element
     /// Erase by an iterator. Return an iterator to the next element
-    Iterator Erase(const Iterator& it)
+    Iterator Erase(Iterator it)
     {
     {
-        if (it)
+        if (it != End())
         {
         {
             Iterator current = it++;
             Iterator current = it++;
             Erase(current->first_);
             Erase(current->first_);
@@ -373,10 +400,10 @@ public:
         size_ = 0;
         size_ = 0;
     }
     }
     
     
-    /// Return iterator to the node with key, or null iterator if not found
-    Iterator Find(const T& key) { return Iterator(FindNode(key)); }
+    /// Return iterator to the node with key, or end iterator if not found
+    Iterator Find(const T& key) { Node* node = FindNode(key); return node ? Iterator(node) : End(); }
     /// Return const iterator to the node with key, or null iterator if not found
     /// Return const iterator to the node with key, or null iterator if not found
-    ConstIterator Find(const T& key) const { return ConstIterator(FindNode(key)); }
+    ConstIterator Find(const T& key) const { Node* node = FindNode(key); return node ? ConstIterator(node) : End(); }
     /// Return iterator to the first actual node
     /// Return iterator to the first actual node
     Iterator Begin() { return Iterator(GetHead()->GetNext(0)); }
     Iterator Begin() { return Iterator(GetHead()->GetNext(0)); }
     /// Return iterator to the first actual node
     /// Return iterator to the first actual node
@@ -385,6 +412,15 @@ public:
     Iterator End() { return Iterator(GetTail()); }
     Iterator End() { return Iterator(GetTail()); }
     /// Return iterator to the end
     /// Return iterator to the end
     ConstIterator End() const { return ConstIterator(GetTail()); }
     ConstIterator End() const { return ConstIterator(GetTail()); }
+    /// Return first pair
+    KeyValue& Front() { return *Begin(); }
+    /// Return const first pair
+    const KeyValue& Front() const { return *Begin(); }
+    /// Return last pair
+    const KeyValue& Back() { return *(--End()); }
+    /// Return const last pair
+    const KeyValue& Back() const { return *(--End()); }
+    
     /// Return whether contains a key
     /// Return whether contains a key
     bool Contains(const T& key) const { return FindNode(key) != 0; }
     bool Contains(const T& key) const { return FindNode(key) != 0; }
     /// Return number of keys
     /// Return number of keys

+ 7 - 3
Engine/Container/PODVector.h

@@ -100,7 +100,7 @@ public:
     }
     }
     
     
     /// Test for equality with another vector
     /// Test for equality with another vector
-    bool operator == (const PODVector<T>& rhs)
+    bool operator == (const PODVector<T>& rhs) const
     {
     {
         if (rhs.size_ != size_)
         if (rhs.size_ != size_)
             return false;
             return false;
@@ -117,7 +117,7 @@ public:
     }
     }
     
     
     /// Test for inequality with another vector
     /// Test for inequality with another vector
-    bool operator != (const PODVector<T>& rhs)
+    bool operator != (const PODVector<T>& rhs) const
     {
     {
         if (rhs.size_ != size_)
         if (rhs.size_ != size_)
             return true;
             return true;
@@ -137,6 +137,10 @@ public:
     T& operator [] (unsigned index) { return GetBuffer()[index]; }
     T& operator [] (unsigned index) { return GetBuffer()[index]; }
     /// Return const element at index
     /// Return const element at index
     const T& operator [] (unsigned index) const { return GetBuffer()[index]; }
     const T& operator [] (unsigned index) const { return GetBuffer()[index]; }
+    /// Return element at index
+    T& At(unsigned index) { return GetBuffer()[index]; }
+    /// Return const element at index
+    const T& At(unsigned index) const { return GetBuffer()[index]; }
     
     
     /// Add an element at the end
     /// Add an element at the end
     void Push(const T& value)
     void Push(const T& value)
@@ -169,7 +173,7 @@ public:
     {
     {
         if (!size_)
         if (!size_)
         {
         {
-            Add(value);
+            Push(value);
             return;
             return;
         }
         }
         
         

+ 24 - 2
Engine/Container/Pair.h

@@ -40,11 +40,33 @@ public:
     }
     }
     
     
     /// Test for equality with another pair
     /// Test for equality with another pair
-    bool operator == (const Pair<T, U>& rhs) { return (first_ == rhs.first_) && (second_ == rhs.second_); }
+    bool operator == (const Pair<T, U>& rhs) const { return (first_ == rhs.first_) && (second_ == rhs.second_); }
     /// Test for inequality with another pair
     /// Test for inequality with another pair
-    bool operator != (const Pair<T, U>& rhs) { return (first_ != rhs.first_) || (second_ != rhs.second_); }
+    bool operator != (const Pair<T, U>& rhs) const { return (first_ != rhs.first_) || (second_ != rhs.second_); }
     
     
+    /// Test for less than with another pair
+    bool operator < (const Pair<T, U>& rhs) const
+    {
+        if (first_ < rhs.first_)
+            return true;
+        if (first_ != rhs.first_)
+            return false;
+        return second_ < rhs.second_;
+    }
+    
+    /// Test for less than with another pair
+    bool operator > (const Pair<T, U>& rhs) const
+    {
+        if (first_ > rhs.first_)
+            return true;
+        if (first_ != rhs.first_)
+            return false;
+        return second_ > rhs.second_;
+    }
+    
+    /// First value
     T first_;
     T first_;
+    /// Second value
     U second_;
     U second_;
 };
 };
 
 

+ 46 - 12
Engine/Container/Set.h

@@ -55,12 +55,24 @@ public:
     /// Set node iterator
     /// Set node iterator
     class Iterator : public ListIteratorBase
     class Iterator : public ListIteratorBase
     {
     {
+        friend class ConstIterator;
+        
     public:
     public:
+        /// Construct
         explicit Iterator(Node* ptr) :
         explicit Iterator(Node* ptr) :
-            ptr_(ptr)
+            ListIteratorBase(ptr)
         {
         {
         }
         }
         
         
+        /// Preincrement the pointer
+        Iterator& operator ++ () { GotoNext(); return *this; }
+        /// Postincrement the pointer
+        Iterator operator ++ (int) { Iterator it = *this; GotoNext(); return it; }
+        /// Predecrement the pointer
+        Iterator& operator -- () { GotoPrev(); return *this; }
+        /// Postdecrement the pointer
+        Iterator operator -- (int) { Iterator it = *this; GotoPrev(); return it; }
+        
         /// Point to the key
         /// Point to the key
         const T* operator -> () const { return &(static_cast<Node*>(ptr_))->key_; }
         const T* operator -> () const { return &(static_cast<Node*>(ptr_))->key_; }
         /// Dereference the key
         /// Dereference the key
@@ -71,11 +83,29 @@ public:
     class ConstIterator : public ListIteratorBase
     class ConstIterator : public ListIteratorBase
     {
     {
     public:
     public:
+        /// Construct
         explicit ConstIterator(Node* ptr) :
         explicit ConstIterator(Node* ptr) :
-            ptr_(ptr)
+            ListIteratorBase(ptr)
         {
         {
         }
         }
         
         
+        /// Construct from a non-const iterator
+        ConstIterator(const Iterator& rhs) :
+            ListIteratorBase(rhs.ptr_)
+        {
+        }
+        
+        /// Assign from a non-const iterator
+        ConstIterator& operator = (const Iterator& rhs) { ptr_ = rhs.ptr_; return *this; }
+        /// Preincrement the pointer
+        ConstIterator& operator ++ () { GotoNext(); return *this; }
+        /// Postincrement the pointer
+        ConstIterator operator ++ (int) { Iterator it = *this; GotoNext(); return it; }
+        /// Predecrement the pointer
+        ConstIterator& operator -- () { GotoPrev(); return *this; }
+        /// Postdecrement the pointer
+        ConstIterator operator -- (int) { Iterator it = *this; GotoPrev(); return it; }
+        
         /// Point to the key
         /// Point to the key
         const T* operator -> () const { return &(static_cast<Node*>(ptr_))->key_; }
         const T* operator -> () const { return &(static_cast<Node*>(ptr_))->key_; }
         /// Dereference the key
         /// Dereference the key
@@ -103,7 +133,7 @@ public:
     
     
     /// Construct from another set
     /// Construct from another set
     Set(const Set<T>& set) :
     Set(const Set<T>& set) :
-        SkipListBase(maxHeight)
+        SkipListBase(set.maxHeight_)
     {
     {
         // Allocate the head and tail nodes and zero the next pointers
         // Allocate the head and tail nodes and zero the next pointers
         head_ = AllocateNode(maxHeight_);
         head_ = AllocateNode(maxHeight_);
@@ -164,8 +194,8 @@ public:
         if (rhs.size_ != size_)
         if (rhs.size_ != size_)
             return false;
             return false;
         
         
-        Iterator i = Begin();
-        Iterator j = rhs.Begin();
+        ConstIterator i = Begin();
+        ConstIterator j = rhs.Begin();
         while (i != End())
         while (i != End())
         {
         {
             if (*i != *j)
             if (*i != *j)
@@ -183,8 +213,8 @@ public:
         if (rhs.size_ != size_)
         if (rhs.size_ != size_)
             return true;
             return true;
         
         
-        Iterator i = Begin();
-        Iterator j = rhs.Begin();
+        ConstIterator i = Begin();
+        ConstIterator j = rhs.Begin();
         while (i != End())
         while (i != End())
         {
         {
             if (*i != *j)
             if (*i != *j)
@@ -270,9 +300,9 @@ public:
     }
     }
     
     
     /// Erase by an iterator. Return an iterator to the next element
     /// Erase by an iterator. Return an iterator to the next element
-    Iterator Erase(const Iterator& it)
+    Iterator Erase(Iterator it)
     {
     {
-        if (it)
+        if (it != End())
         {
         {
             Iterator current = it++;
             Iterator current = it++;
             Erase(*current);
             Erase(*current);
@@ -323,10 +353,10 @@ public:
         size_ = 0;
         size_ = 0;
     }
     }
     
     
-    /// Return iterator to the node with key, or null iterator if not found
-    Iterator Find(const T& key) { return Iterator(FindNode(key)); }
+    /// Return iterator to the node with key, or end iterator if not found
+    Iterator Find(const T& key) { Node* node = FindNode(key); return node ? Iterator(node) : End(); }
     /// Return const iterator to the node with key, or null iterator if not found
     /// Return const iterator to the node with key, or null iterator if not found
-    ConstIterator Find(const T& key) const { return ConstIterator(FindNode(key)); }
+    ConstIterator Find(const T& key) const { Node* node = FindNode(key); return node ? ConstIterator(node) : End(); }
     /// Return iterator to the first actual node
     /// Return iterator to the first actual node
     Iterator Begin() { return Iterator(GetHead()->GetNext(0)); }
     Iterator Begin() { return Iterator(GetHead()->GetNext(0)); }
     /// Return iterator to the first actual node
     /// Return iterator to the first actual node
@@ -335,6 +365,10 @@ public:
     Iterator End() { return Iterator(GetTail()); }
     Iterator End() { return Iterator(GetTail()); }
     /// Return iterator to the end
     /// Return iterator to the end
     ConstIterator End() const { return ConstIterator(GetTail()); }
     ConstIterator End() const { return ConstIterator(GetTail()); }
+    /// Return first key
+    const T& Front() const { return *Begin(); }
+    /// Return last key
+    const T& Back() const { return *(--End()); }
     /// Return whether contains a key
     /// Return whether contains a key
     bool Contains(const T& key) const { return FindNode(key) != 0; }
     bool Contains(const T& key) const { return FindNode(key) != 0; }
     /// Return number of keys
     /// Return number of keys

+ 20 - 19
Engine/Container/Sort.h

@@ -23,6 +23,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include "Iterator.h"
 #include "Swap.h"
 #include "Swap.h"
 
 
 static const int QUICKSORT_THRESHOLD = 16;
 static const int QUICKSORT_THRESHOLD = 16;
@@ -30,12 +31,12 @@ static const int QUICKSORT_THRESHOLD = 16;
 // Based on http://warp.povusers.org/SortComparison/
 // Based on http://warp.povusers.org/SortComparison/
 
 
 /// Perform insertion sort on an array
 /// Perform insertion sort on an array
-template <class T> void InsertionSort(T* begin, T* end)
+template <class T> void InsertionSort(RandomAccessIterator<T> begin, RandomAccessIterator<T> end)
 {
 {
-    for (T* i = begin + 1; i < end; ++i)
+    for (RandomAccessIterator<T> i = begin + 1; i < end; ++i)
     {
     {
         T temp = *i;
         T temp = *i;
-        T* j = i;
+        RandomAccessIterator<T> j = i;
         while ((j > begin) && (temp < *(j - 1)))
         while ((j > begin) && (temp < *(j - 1)))
         {
         {
             *j = *(j - 1);
             *j = *(j - 1);
@@ -46,12 +47,12 @@ template <class T> void InsertionSort(T* begin, T* end)
 }
 }
 
 
 /// Perform insertion sort on an array using a compare function
 /// Perform insertion sort on an array using a compare function
-template <class T> void InsertionSort(T* begin, T* end, bool (*compare)(const T&, const T&))
+template <class T, class U> void InsertionSort(RandomAccessIterator<T> begin, RandomAccessIterator<T> end, U compare)
 {
 {
-    for (T* i = begin + 1; i < end; ++i)
+    for (RandomAccessIterator<T> i = begin + 1; i < end; ++i)
     {
     {
         T temp = *i;
         T temp = *i;
-        T* j = i;
+        RandomAccessIterator<T> j = i;
         while ((j > begin) && (compare(temp, *(j - 1))))
         while ((j > begin) && (compare(temp, *(j - 1))))
         {
         {
             *j = *(j - 1);
             *j = *(j - 1);
@@ -62,20 +63,20 @@ template <class T> void InsertionSort(T* begin, T* end, bool (*compare)(const T&
 }
 }
 
 
 /// Perform quick sort initial pass on an array. Does not sort fully
 /// Perform quick sort initial pass on an array. Does not sort fully
-template <class T> void InitialQuickSort(T* begin, T* end)
+template <class T> void InitialQuickSort(RandomAccessIterator<T> begin, RandomAccessIterator<T> end)
 {
 {
-    while (begin + QUICKSORT_THRESHOLD < end)
+    while (end - begin > QUICKSORT_THRESHOLD)
     {
     {
         // Choose the pivot by median
         // Choose the pivot by median
-        T* pivot = begin + ((end - begin) / 2);
+        RandomAccessIterator<T> pivot = begin + ((end - begin) / 2);
         if ((*begin < *pivot) && (*(end - 1) < *begin))
         if ((*begin < *pivot) && (*(end - 1) < *begin))
             pivot = begin;
             pivot = begin;
         else if ((*(end - 1) < *pivot) && (*begin < *(end - 1)))
         else if ((*(end - 1) < *pivot) && (*begin < *(end - 1)))
             pivot = end - 1;
             pivot = end - 1;
         
         
         // Partition and sort recursively
         // Partition and sort recursively
-        T* i = begin - 1;
-        T* j = end;
+        RandomAccessIterator<T> i = begin - 1;
+        RandomAccessIterator<T> j = end;
         T pivotValue = *pivot;
         T pivotValue = *pivot;
         for (;;)
         for (;;)
         {
         {
@@ -93,20 +94,20 @@ template <class T> void InitialQuickSort(T* begin, T* end)
 }
 }
 
 
 /// Perform quick sort initial pass on an array using a compare function. Does not sort fully
 /// Perform quick sort initial pass on an array using a compare function. Does not sort fully
-template <class T> void InitialQuickSort(T* begin, T* end, bool (*compare)(const T&, const T&))
+template <class T, class U> void InitialQuickSort(RandomAccessIterator<T> begin, RandomAccessIterator<T> end, U compare)
 {
 {
-    while (begin + QUICKSORT_THRESHOLD < end)
+    while (end - begin > QUICKSORT_THRESHOLD)
     {
     {
         // Choose the pivot by median
         // Choose the pivot by median
-        T* pivot = begin + ((end - begin) / 2);
+        RandomAccessIterator<T> pivot = begin + ((end - begin) / 2);
         if ((compare(*begin, *pivot)) && (compare(*(end - 1), *begin)))
         if ((compare(*begin, *pivot)) && (compare(*(end - 1), *begin)))
             pivot = begin;
             pivot = begin;
         else if ((compare(*(end - 1), *pivot)) && (compare(*begin, *(end - 1))))
         else if ((compare(*(end - 1), *pivot)) && (compare(*begin, *(end - 1))))
             pivot = end - 1;
             pivot = end - 1;
         
         
         // Partition and sort recursively
         // Partition and sort recursively
-        T* i = begin - 1;
-        T* j = end;
+        RandomAccessIterator<T> i = begin - 1;
+        RandomAccessIterator<T> j = end;
         T pivotValue = *pivot;
         T pivotValue = *pivot;
         for (;;)
         for (;;)
         {
         {
@@ -118,20 +119,20 @@ template <class T> void InitialQuickSort(T* begin, T* end, bool (*compare)(const
                 break;
                 break;
         }
         }
         
         
-        InitialQuickSort(begin, j + 1);
+        InitialQuickSort(begin, j + 1, compare);
         begin = j + 1;
         begin = j + 1;
     }
     }
 }
 }
 
 
 /// Sort in ascending order using quicksort for initial passes, then an insertion sort to finalize
 /// Sort in ascending order using quicksort for initial passes, then an insertion sort to finalize
-template <class T> void Sort(T* begin, T* end)
+template <class T> void Sort(RandomAccessIterator<T> begin, RandomAccessIterator<T> end)
 {
 {
     InitialQuickSort(begin, end);
     InitialQuickSort(begin, end);
     InsertionSort(begin, end);
     InsertionSort(begin, end);
 }
 }
 
 
 /// Sort in ascending order using quicksort for initial passes, then an insertion sort to finalize, using a compare function
 /// Sort in ascending order using quicksort for initial passes, then an insertion sort to finalize, using a compare function
-template <class T> void Sort(T* begin, T* end, bool (*compare)(const T&, const T&))
+template <class T, class U> void Sort(RandomAccessIterator<T> begin, RandomAccessIterator<T> end, U compare)
 {
 {
     InitialQuickSort(begin, end, compare);
     InitialQuickSort(begin, end, compare);
     InsertionSort(begin, end, compare);
     InsertionSort(begin, end, compare);

+ 1 - 1
Engine/Container/String.cpp

@@ -112,7 +112,7 @@ String::Iterator String::Insert(const String::Iterator& dest, const String::Iter
     if (pos > length_)
     if (pos > length_)
         pos = length_;
         pos = length_;
     unsigned length = end - start;
     unsigned length = end - start;
-    ReplaceInPlace(pos, 0, start, length);
+    ReplaceInPlace(pos, 0, &(*start), length);
     
     
     return Begin() + pos;
     return Begin() + pos;
 }
 }

+ 8 - 4
Engine/Container/Vector.h

@@ -100,7 +100,7 @@ public:
     }
     }
     
     
     /// Test for equality with another vector
     /// Test for equality with another vector
-    bool operator == (const Vector<T>& rhs)
+    bool operator == (const Vector<T>& rhs) const
     {
     {
         if (rhs.size_ != size_)
         if (rhs.size_ != size_)
             return false;
             return false;
@@ -117,7 +117,7 @@ public:
     }
     }
     
     
     /// Test for inequality with another vector
     /// Test for inequality with another vector
-    bool operator != (const Vector<T>& rhs)
+    bool operator != (const Vector<T>& rhs) const
     {
     {
         if (rhs.size_ != size_)
         if (rhs.size_ != size_)
             return true;
             return true;
@@ -137,7 +137,11 @@ public:
     T& operator [] (unsigned index) { return GetBuffer()[index]; }
     T& operator [] (unsigned index) { return GetBuffer()[index]; }
     /// Return const element at index
     /// Return const element at index
     const T& operator [] (unsigned index) const { return GetBuffer()[index]; }
     const T& operator [] (unsigned index) const { return GetBuffer()[index]; }
-    
+    /// Return element at index
+    T& At(unsigned index) { return GetBuffer()[index]; }
+    /// Return const element at index
+    const T& At(unsigned index) const { return GetBuffer()[index]; }
+
     /// Add an element at the end
     /// Add an element at the end
     void Push(const T& value)
     void Push(const T& value)
     {
     {
@@ -169,7 +173,7 @@ public:
     {
     {
         if (!size_)
         if (!size_)
         {
         {
-            Add(value);
+            Push(value);
             return;
             return;
         }
         }
         
         

+ 41 - 41
Engine/Core/Context.cpp

@@ -37,17 +37,17 @@ Context::Context() :
 Context::~Context()
 Context::~Context()
 {
 {
     // Release the subsystems before the event receiver maps are destroyed
     // Release the subsystems before the event receiver maps are destroyed
-    for (std::map<ShortStringHash, SharedPtr<Object> >::iterator i = subsystems_.begin(); i != subsystems_.end(); ++i)
-        i->second.Reset();
-    subsystems_.clear();
-    factories_.clear();
+    for (Map<ShortStringHash, SharedPtr<Object> >::Iterator i = subsystems_.Begin(); i != subsystems_.End(); ++i)
+        i->second_.Reset();
+    subsystems_.Clear();
+    factories_.Clear();
 }
 }
 
 
 SharedPtr<Object> Context::CreateObject(ShortStringHash objectType)
 SharedPtr<Object> Context::CreateObject(ShortStringHash objectType)
 {
 {
-    std::map<ShortStringHash, SharedPtr<ObjectFactory> >::const_iterator i = factories_.find(objectType);
-    if (i != factories_.end())
-        return i->second->CreateObject();
+    Map<ShortStringHash, SharedPtr<ObjectFactory> >::ConstIterator i = factories_.Find(objectType);
+    if (i != factories_.End())
+        return i->second_->CreateObject();
     else
     else
         return SharedPtr<Object>();
         return SharedPtr<Object>();
 }
 }
@@ -74,17 +74,17 @@ void Context::RegisterAttribute(ShortStringHash objectType, const AttributeInfo&
     if ((attr.type_ == VAR_NONE) || (attr.type_ == VAR_PTR))
     if ((attr.type_ == VAR_NONE) || (attr.type_ == VAR_PTR))
         return;
         return;
     
     
-    attributes_[objectType].push_back(attr);
+    attributes_[objectType].Push(attr);
 }
 }
 
 
 void Context::RemoveAttribute(ShortStringHash objectType, const String& name)
 void Context::RemoveAttribute(ShortStringHash objectType, const String& name)
 {
 {
-    std::vector<AttributeInfo>& attributes = attributes_[objectType];
-    for (std::vector<AttributeInfo>::iterator i = attributes.begin(); i != attributes.end(); ++i)
+    Vector<AttributeInfo>& attributes = attributes_[objectType];
+    for (Vector<AttributeInfo>::Iterator i = attributes.Begin(); i != attributes.End(); ++i)
     {
     {
         if (i->name_ == name)
         if (i->name_ == name)
         {
         {
-            attributes.erase(i);
+            attributes.Erase(i);
             return;
             return;
         }
         }
     }
     }
@@ -97,65 +97,65 @@ void Context::CopyBaseAttributes(ShortStringHash baseType, ShortStringHash deriv
 
 
 void Context::AddEventReceiver(Object* receiver, StringHash eventType)
 void Context::AddEventReceiver(Object* receiver, StringHash eventType)
 {
 {
-    std::vector<Object*>& receivers = receivers_[eventType];
-    for (std::vector<Object*>::const_iterator j = receivers.begin(); j != receivers.end(); ++j)
+    Vector<Object*>& receivers = receivers_[eventType];
+    for (Vector<Object*>::ConstIterator j = receivers.Begin(); j != receivers.End(); ++j)
     {
     {
         // Check if already registered
         // Check if already registered
         if (*j == receiver)
         if (*j == receiver)
             return;
             return;
     }
     }
     
     
-    receivers.push_back(receiver);
+    receivers.Push(receiver);
 }
 }
 
 
 void Context::AddEventReceiver(Object* receiver, Object* sender, StringHash eventType)
 void Context::AddEventReceiver(Object* receiver, Object* sender, StringHash eventType)
 {
 {
-    std::vector<Object*>& receivers = specificReceivers_[std::make_pair(sender, eventType)];
-    for (std::vector<Object*>::const_iterator j = receivers.begin(); j != receivers.end(); ++j)
+    Vector<Object*>& receivers = specificReceivers_[MakePair(sender, eventType)];
+    for (Vector<Object*>::ConstIterator j = receivers.Begin(); j != receivers.End(); ++j)
     {
     {
         if (*j == receiver)
         if (*j == receiver)
             return;
             return;
     }
     }
     
     
-    receivers.push_back(receiver);
+    receivers.Push(receiver);
 }
 }
 
 
 void Context::RemoveEventSender(Object* sender)
 void Context::RemoveEventSender(Object* sender)
 {
 {
-    for (std::map<std::pair<Object*, StringHash>, std::vector<Object*> >::iterator i = specificReceivers_.begin();
-        i != specificReceivers_.end();)
+    for (Map<Pair<Object*, StringHash>, Vector<Object*> >::Iterator i = specificReceivers_.Begin();
+        i != specificReceivers_.End();)
     {
     {
-        std::map<std::pair<Object*, StringHash>, std::vector<Object*> >::iterator current = i++;
-        if (current->first.first == sender)
+        Map<Pair<Object*, StringHash>, Vector<Object*> >::Iterator current = i++;
+        if (current->first_.first_ == sender)
         {
         {
-            std::vector<Object*>& receivers = current->second;
-            for (std::vector<Object*>::iterator j = receivers.begin(); j != receivers.end(); ++j)
+            Vector<Object*>& receivers = current->second_;
+            for (Vector<Object*>::Iterator j = receivers.Begin(); j != receivers.End(); ++j)
             {
             {
                 if (*j)
                 if (*j)
                     (*j)->RemoveEventSender(sender);
                     (*j)->RemoveEventSender(sender);
             }
             }
-            specificReceivers_.erase(current);
+            specificReceivers_.Erase(current);
         }
         }
     }
     }
 }
 }
 
 
 void Context::RemoveEventReceiver(Object* receiver, StringHash eventType)
 void Context::RemoveEventReceiver(Object* receiver, StringHash eventType)
 {
 {
-    std::vector<Object*>* group = GetReceivers(eventType);
+    Vector<Object*>* group = GetReceivers(eventType);
     if (!group)
     if (!group)
         return;
         return;
     
     
-    for (std::vector<Object*>::iterator i = group->begin(); i != group->end(); ++i)
+    for (Vector<Object*>::Iterator i = group->Begin(); i != group->End(); ++i)
     {
     {
         if (*i == receiver)
         if (*i == receiver)
         {
         {
             // If no event handling going on, can erase the receiver. Otherwise reset the pointer and clean up later
             // If no event handling going on, can erase the receiver. Otherwise reset the pointer and clean up later
-            if (senders_.empty())
-                group->erase(i);
+            if (senders_.Empty())
+                group->Erase(i);
             else
             else
             {
             {
                 *i = 0;
                 *i = 0;
-                dirtyReceivers_.insert(eventType);
+                dirtyReceivers_.Insert(eventType);
             }
             }
             return;
             return;
         }
         }
@@ -164,20 +164,20 @@ void Context::RemoveEventReceiver(Object* receiver, StringHash eventType)
 
 
 void Context::RemoveEventReceiver(Object* receiver, Object* sender, StringHash eventType)
 void Context::RemoveEventReceiver(Object* receiver, Object* sender, StringHash eventType)
 {
 {
-    std::vector<Object*>* group = GetReceivers(sender, eventType);
+    Vector<Object*>* group = GetReceivers(sender, eventType);
     if (!group)
     if (!group)
         return;
         return;
     
     
-    for (std::vector<Object*>::iterator i = group->begin(); i != group->end(); ++i)
+    for (Vector<Object*>::Iterator i = group->Begin(); i != group->End(); ++i)
     {
     {
         if (*i == receiver)
         if (*i == receiver)
         {
         {
-            if (senders_.empty())
-                group->erase(i);
+            if (senders_.Empty())
+                group->Erase(i);
             else
             else
             {
             {
                 *i = 0;
                 *i = 0;
-                dirtySpecificReceivers_.insert(std::make_pair(sender, eventType));
+                dirtySpecificReceivers_.Insert(MakePair(sender, eventType));
             }
             }
             return;
             return;
         }
         }
@@ -186,17 +186,17 @@ void Context::RemoveEventReceiver(Object* receiver, Object* sender, StringHash e
 
 
 Object* Context::GetSubsystem(ShortStringHash type) const
 Object* Context::GetSubsystem(ShortStringHash type) const
 {
 {
-    std::map<ShortStringHash, SharedPtr<Object> >::const_iterator i = subsystems_.find(type);
-    if (i != subsystems_.end())
-        return i->second;
+    Map<ShortStringHash, SharedPtr<Object> >::ConstIterator i = subsystems_.Find(type);
+    if (i != subsystems_.End())
+        return i->second_;
     else
     else
         return 0;
         return 0;
 }
 }
 
 
 Object* Context::GetSender() const
 Object* Context::GetSender() const
 {
 {
-    if (!senders_.empty())
-        return senders_.back();
+    if (!senders_.Empty())
+        return senders_.Back();
     else
     else
         return 0;
         return 0;
 }
 }
@@ -204,6 +204,6 @@ Object* Context::GetSender() const
 const String& Context::GetTypeName(ShortStringHash type) const
 const String& Context::GetTypeName(ShortStringHash type) const
 {
 {
     // Search factories to find the hash-to-name mapping
     // Search factories to find the hash-to-name mapping
-    std::map<ShortStringHash, SharedPtr<ObjectFactory> >::const_iterator i = factories_.find(type);
-    return (i != factories_.end()) ? i->second->GetTypeName() : noType;
+    Map<ShortStringHash, SharedPtr<ObjectFactory> >::ConstIterator i = factories_.Find(type);
+    return (i != factories_.End()) ? i->second_->GetTypeName() : noType;
 }
 }

+ 40 - 40
Engine/Core/Context.h

@@ -26,9 +26,9 @@
 #include "Attribute.h"
 #include "Attribute.h"
 #include "Object.h"
 #include "Object.h"
 
 
-#include <map>
-#include <set>
-#include <vector>
+#include "Map.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
@@ -71,48 +71,48 @@ public:
     /// Begin event send
     /// Begin event send
     void BeginSendEvent(Object* sender)
     void BeginSendEvent(Object* sender)
     {
     {
-        senders_.push_back(sender);
+        senders_.Push(sender);
     }
     }
     
     
     /// End event send. Clean up event receivers removed in the meanwhile
     /// End event send. Clean up event receivers removed in the meanwhile
     void EndSendEvent()
     void EndSendEvent()
     {
     {
-        senders_.pop_back();
+        senders_.Pop();
     
     
         // Clean up dirtied event receiver groups when event handling finishes
         // Clean up dirtied event receiver groups when event handling finishes
-        if (senders_.empty())
+        if (senders_.Empty())
         {
         {
-            if (!dirtySpecificReceivers_.empty())
+            if (!dirtySpecificReceivers_.Empty())
             {
             {
-                for (std::set<std::pair<Object*, StringHash> >::iterator i = dirtySpecificReceivers_.begin();
-                    i != dirtySpecificReceivers_.end(); ++i)
+                for (Set<Pair<Object*, StringHash> >::Iterator i = dirtySpecificReceivers_.Begin();
+                    i != dirtySpecificReceivers_.End(); ++i)
                 {
                 {
-                    std::vector<Object*>& receivers = specificReceivers_[*i];
-                    for (std::vector<Object*>::iterator j = receivers.begin(); j != receivers.end();)
+                    Vector<Object*>& receivers = specificReceivers_[*i];
+                    for (Vector<Object*>::Iterator j = receivers.Begin(); j != receivers.End();)
                     {
                     {
                         if (*j == 0)
                         if (*j == 0)
-                            j = receivers.erase(j);
+                            j = receivers.Erase(j);
                         else
                         else
                             ++j;
                             ++j;
                     }
                     }
                 }
                 }
-                dirtySpecificReceivers_.clear();
+                dirtySpecificReceivers_.Clear();
             }
             }
             
             
-            if (!dirtyReceivers_.empty())
+            if (!dirtyReceivers_.Empty())
             {
             {
-                for (std::set<StringHash>::iterator i = dirtyReceivers_.begin(); i != dirtyReceivers_.end(); ++i)
+                for (Set<StringHash>::Iterator i = dirtyReceivers_.Begin(); i != dirtyReceivers_.End(); ++i)
                 {
                 {
-                    std::vector<Object*>& receivers = receivers_[*i];
-                    for (std::vector<Object*>::iterator j = receivers.begin(); j != receivers.end();)
+                    Vector<Object*>& receivers = receivers_[*i];
+                    for (Vector<Object*>::Iterator j = receivers.Begin(); j != receivers.End();)
                     {
                     {
                         if (*j == 0)
                         if (*j == 0)
-                            j = receivers.erase(j);
+                            j = receivers.Erase(j);
                         else
                         else
                             ++j;
                             ++j;
                     }
                     }
                 }
                 }
-                dirtyReceivers_.clear();
+                dirtyReceivers_.Clear();
             }
             }
         }
         }
     }
     }
@@ -129,11 +129,11 @@ public:
     /// Return subsystem by type
     /// Return subsystem by type
     Object* GetSubsystem(ShortStringHash type) const;
     Object* GetSubsystem(ShortStringHash type) const;
     /// Return all subsystems
     /// Return all subsystems
-    const std::map<ShortStringHash, SharedPtr<Object> >& GetSubsystems() const { return subsystems_; }
+    const Map<ShortStringHash, SharedPtr<Object> >& GetSubsystems() const { return subsystems_; }
     /// Return all object factories
     /// Return all object factories
-    const std::map<ShortStringHash, SharedPtr<ObjectFactory> >& GetObjectFactories() const { return factories_; }
+    const Map<ShortStringHash, SharedPtr<ObjectFactory> >& GetObjectFactories() const { return factories_; }
     /// Return attributes for all object types
     /// Return attributes for all object types
-    const std::map<ShortStringHash, std::vector<AttributeInfo> >& GetAllAttributes() const { return attributes_; }
+    const Map<ShortStringHash, Vector<AttributeInfo> >& GetAllAttributes() const { return attributes_; }
     /// Return active event sender. Null outside event handling
     /// Return active event sender. Null outside event handling
     Object* GetSender() const;
     Object* GetSender() const;
     /// Return active event handler. Set by Object. Null outside event handling
     /// Return active event handler. Set by Object. Null outside event handling
@@ -144,44 +144,44 @@ public:
     template <class T> T* GetSubsystem() const;
     template <class T> T* GetSubsystem() const;
     
     
     /// Return attribute descriptions for an object type, or null if none defined
     /// Return attribute descriptions for an object type, or null if none defined
-    const std::vector<AttributeInfo>* GetAttributes(ShortStringHash type) const
+    const Vector<AttributeInfo>* GetAttributes(ShortStringHash type) const
     {
     {
-        std::map<ShortStringHash, std::vector<AttributeInfo> >::const_iterator i = attributes_.find(type);
-        return (i != attributes_.end()) ? &i->second : 0;
+        Map<ShortStringHash, Vector<AttributeInfo> >::ConstIterator i = attributes_.Find(type);
+        return (i != attributes_.End()) ? &i->second_ : 0;
     }
     }
     
     
     /// Return event receivers for a sender and event type, or null if they do not exist
     /// Return event receivers for a sender and event type, or null if they do not exist
-    std::vector<Object*>* GetReceivers(Object* sender, StringHash eventType)
+    Vector<Object*>* GetReceivers(Object* sender, StringHash eventType)
     {
     {
-        std::map<std::pair<Object*, StringHash>, std::vector<Object*> >::iterator i = 
-            specificReceivers_.find(std::make_pair(sender, eventType));
-        return (i != specificReceivers_.end()) ? &i->second : 0;
+        Map<Pair<Object*, StringHash>, Vector<Object*> >::Iterator i = 
+            specificReceivers_.Find(MakePair(sender, eventType));
+        return (i != specificReceivers_.End()) ? &i->second_ : 0;
     }
     }
     
     
     /// Return event receivers for an event type, or null if they do not exist
     /// Return event receivers for an event type, or null if they do not exist
-    std::vector<Object*>* GetReceivers(StringHash eventType)
+    Vector<Object*>* GetReceivers(StringHash eventType)
     {
     {
-        std::map<StringHash, std::vector<Object*> >::iterator i = receivers_.find(eventType);
-        return (i != receivers_.end()) ? &i->second : 0;
+        Map<StringHash, Vector<Object*> >::Iterator i = receivers_.Find(eventType);
+        return (i != receivers_.End()) ? &i->second_ : 0;
     }
     }
     
     
 private:
 private:
     /// Object factories
     /// Object factories
-    std::map<ShortStringHash, SharedPtr<ObjectFactory> > factories_;
+    Map<ShortStringHash, SharedPtr<ObjectFactory> > factories_;
     /// Subsystems
     /// Subsystems
-    std::map<ShortStringHash, SharedPtr<Object> > subsystems_;
+    Map<ShortStringHash, SharedPtr<Object> > subsystems_;
     /// Attribute descriptions per object type
     /// Attribute descriptions per object type
-    std::map<ShortStringHash, std::vector<AttributeInfo> > attributes_;
+    Map<ShortStringHash, Vector<AttributeInfo> > attributes_;
     /// Event receivers for non-specific events
     /// Event receivers for non-specific events
-    std::map<StringHash, std::vector<Object*> > receivers_;
+    Map<StringHash, Vector<Object*> > receivers_;
     /// Event receivers for specific senders' events
     /// Event receivers for specific senders' events
-    std::map<std::pair<Object*, StringHash>, std::vector<Object*> > specificReceivers_;
+    Map<Pair<Object*, StringHash>, Vector<Object*> > specificReceivers_;
     /// Event sender stack
     /// Event sender stack
-    std::vector<Object*> senders_;
+    Vector<Object*> senders_;
     /// Event types that have had receivers removed during event handling
     /// Event types that have had receivers removed during event handling
-    std::set<StringHash> dirtyReceivers_;
+    Set<StringHash> dirtyReceivers_;
     /// Event types for specific senders that have had receivers removed during event handling
     /// Event types for specific senders that have had receivers removed during event handling
-    std::set<std::pair<Object*, StringHash> > dirtySpecificReceivers_;
+    Set<Pair<Object*, StringHash> > dirtySpecificReceivers_;
     /// Active event handler. Not stored in a stack for performance reasons; is needed only in esoteric cases
     /// Active event handler. Not stored in a stack for performance reasons; is needed only in esoteric cases
     WeakPtr<EventHandler> handler_;
     WeakPtr<EventHandler> handler_;
 };
 };

+ 4 - 0
Engine/Core/DebugNew.h

@@ -27,6 +27,10 @@
 
 
 #define _CRTDBG_MAP_ALLOC
 #define _CRTDBG_MAP_ALLOC
 
 
+#ifdef _malloca
+#undef _malloca
+#endif
+
 #include <crtdbg.h>
 #include <crtdbg.h>
 
 
 #define _DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
 #define _DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)

+ 65 - 65
Engine/Core/Object.cpp

@@ -46,23 +46,23 @@ void Object::OnEvent(Object* sender, bool broadcast, StringHash eventType, Varia
     WeakPtr<Object> self(this);
     WeakPtr<Object> self(this);
     
     
     // Check first the specific event handlers, which have priority
     // Check first the specific event handlers, which have priority
-    std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::const_iterator i = eventHandlers_.find(
-        std::make_pair(sender, eventType));
-    if (i != eventHandlers_.end())
+    Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::ConstIterator i = eventHandlers_.Find(
+        MakePair(sender, eventType));
+    if (i != eventHandlers_.End())
     {
     {
-        context_->SetEventHandler(i->second);
-        i->second->Invoke(eventType, eventData);
+        context_->SetEventHandler(i->second_);
+        i->second_->Invoke(eventType, eventData);
         if (!self.IsExpired())
         if (!self.IsExpired())
             context_->SetEventHandler(0);
             context_->SetEventHandler(0);
         return;
         return;
     }
     }
     
     
     // Then check non-specific (null sender pointer)
     // Then check non-specific (null sender pointer)
-    i = eventHandlers_.find(std::make_pair((Object*)0, eventType));
-    if (i != eventHandlers_.end())
+    i = eventHandlers_.Find(MakePair((Object*)0, eventType));
+    if (i != eventHandlers_.End())
     {
     {
-        context_->SetEventHandler(i->second);
-        i->second->Invoke(eventType, eventData);
+        context_->SetEventHandler(i->second_);
+        i->second_->Invoke(eventType, eventData);
         if (!self.IsExpired())
         if (!self.IsExpired())
             context_->SetEventHandler(0);
             context_->SetEventHandler(0);
     }
     }
@@ -73,7 +73,7 @@ void Object::SubscribeToEvent(StringHash eventType, EventHandler* handler)
     if (!handler)
     if (!handler)
         return;
         return;
     
     
-    std::pair<Object*, StringHash> combination((Object*)0, eventType);
+    Pair<Object*, StringHash> combination((Object*)0, eventType);
     
     
     eventHandlers_[combination] = handler;
     eventHandlers_[combination] = handler;
     context_->AddEventReceiver(this, eventType);
     context_->AddEventReceiver(this, eventType);
@@ -84,7 +84,7 @@ void Object::SubscribeToEvent(Object* sender, StringHash eventType, EventHandler
     if ((!sender) || (!handler))
     if ((!sender) || (!handler))
         return; 
         return; 
     
     
-    std::pair<Object*, StringHash> combination(sender, eventType);
+    Pair<Object*, StringHash> combination(sender, eventType);
     
     
     eventHandlers_[combination] = handler;
     eventHandlers_[combination] = handler;
     context_->AddEventReceiver(this, sender, eventType);
     context_->AddEventReceiver(this, sender, eventType);
@@ -92,30 +92,30 @@ void Object::SubscribeToEvent(Object* sender, StringHash eventType, EventHandler
 
 
 void Object::UnsubscribeFromEvent(StringHash eventType)
 void Object::UnsubscribeFromEvent(StringHash eventType)
 {
 {
-    for (std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator i = eventHandlers_.begin();
-        i != eventHandlers_.end();)
+    for (Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator i = eventHandlers_.Begin();
+        i != eventHandlers_.End();)
     {
     {
-        std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator current = i++;
-        if (current->first.second == eventType)
+        Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator current = i++;
+        if (current->first_.second_ == eventType)
         {
         {
-            if (current->first.first)
-                context_->RemoveEventReceiver(this, current->first.first, current->first.second);
+            if (current->first_.first_)
+                context_->RemoveEventReceiver(this, current->first_.first_, current->first_.second_);
             else
             else
-                context_->RemoveEventReceiver(this, current->first.second);
-            eventHandlers_.erase(current);
+                context_->RemoveEventReceiver(this, current->first_.second_);
+            eventHandlers_.Erase(current);
         }
         }
     }
     }
 }
 }
 
 
 void Object::UnsubscribeFromEvent(Object* sender, StringHash eventType)
 void Object::UnsubscribeFromEvent(Object* sender, StringHash eventType)
 {
 {
-    std::pair<Object*, StringHash> combination(sender, eventType);
+    Pair<Object*, StringHash> combination(sender, eventType);
     
     
-    std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator i = eventHandlers_.find(combination);
-    if (i != eventHandlers_.end())
+    Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator i = eventHandlers_.Find(combination);
+    if (i != eventHandlers_.End())
     {
     {
-        context_->RemoveEventReceiver(this, i->first.first, i->first.second);
-        eventHandlers_.erase(i);
+        context_->RemoveEventReceiver(this, i->first_.first_, i->first_.second_);
+        eventHandlers_.Erase(i);
     }
     }
 }
 }
 
 
@@ -124,45 +124,45 @@ void Object::UnsubscribeFromEvents(Object* sender)
     if (!sender)
     if (!sender)
         return;
         return;
     
     
-    for (std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator i = eventHandlers_.begin();
-        i != eventHandlers_.end();)
+    for (Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator i = eventHandlers_.Begin();
+        i != eventHandlers_.End();)
     {
     {
-        std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator current = i++;
-        if (current->first.first == sender)
+        Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator current = i++;
+        if (current->first_.first_ == sender)
         {
         {
-            context_->RemoveEventReceiver(this, current->first.first, current->first.second);
-            eventHandlers_.erase(current);
+            context_->RemoveEventReceiver(this, current->first_.first_, current->first_.second_);
+            eventHandlers_.Erase(current);
         }
         }
     }
     }
 }
 }
 
 
 void Object::UnsubscribeFromAllEvents()
 void Object::UnsubscribeFromAllEvents()
 {
 {
-    for (std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator i = eventHandlers_.begin();
-        i != eventHandlers_.end(); ++i)
+    for (Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator i = eventHandlers_.Begin();
+        i != eventHandlers_.End(); ++i)
     {
     {
-        if (i->first.first)
-            context_->RemoveEventReceiver(this, i->first.first, i->first.second);
+        if (i->first_.first_)
+            context_->RemoveEventReceiver(this, i->first_.first_, i->first_.second_);
         else
         else
-            context_->RemoveEventReceiver(this, i->first.second);
+            context_->RemoveEventReceiver(this, i->first_.second_);
     }
     }
     
     
-    eventHandlers_.clear();
+    eventHandlers_.Clear();
 }
 }
 
 
 void Object::UnsubscribeFromAllEventsWithUserData()
 void Object::UnsubscribeFromAllEventsWithUserData()
 {
 {
-    for (std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator i = eventHandlers_.begin();
-        i != eventHandlers_.end(); )
+    for (Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator i = eventHandlers_.Begin();
+        i != eventHandlers_.End(); )
     {
     {
-        if (i->second->GetUserData())
+        if (i->second_->GetUserData())
         {
         {
-            std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator current = i++;
-            if (current->first.first)
-                context_->RemoveEventReceiver(this, current->first.first, current->first.second);
+            Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator current = i++;
+            if (current->first_.first_)
+                context_->RemoveEventReceiver(this, current->first_.first_, current->first_.second_);
             else
             else
-                context_->RemoveEventReceiver(this, current->first.second);
-            eventHandlers_.erase(current);
+                context_->RemoveEventReceiver(this, current->first_.second_);
+            eventHandlers_.Erase(current);
         }
         }
         else
         else
             ++i;
             ++i;
@@ -178,22 +178,22 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
 {
 {
     // Make a weak pointer to self to check for destruction during event handling
     // Make a weak pointer to self to check for destruction during event handling
     WeakPtr<Object> self(this);
     WeakPtr<Object> self(this);
-    std::set<Object*> processed;
+    Set<Object*> processed;
     
     
     context_->BeginSendEvent(this);
     context_->BeginSendEvent(this);
     
     
     // Check first the specific event receivers
     // Check first the specific event receivers
-    const std::vector<Object*>* group = context_->GetReceivers(this, eventType);
+    const Vector<Object*>* group = context_->GetReceivers(this, eventType);
     if (group)
     if (group)
     {
     {
-        unsigned numReceivers = group->size();
+        unsigned numReceivers = group->Size();
         for (unsigned j = 0; j < numReceivers; ++j)
         for (unsigned j = 0; j < numReceivers; ++j)
         {
         {
-            Object* receiver = group->at(j);
+            Object* receiver = group->At(j);
             // There may be null pointers due to not removing vector elements during event handling, so check
             // There may be null pointers due to not removing vector elements during event handling, so check
             if (receiver)
             if (receiver)
             {
             {
-                processed.insert(receiver);
+                processed.Insert(receiver);
                 receiver->OnEvent(this, true, eventType, eventData);
                 receiver->OnEvent(this, true, eventType, eventData);
                 if (self.IsExpired())
                 if (self.IsExpired())
                 {
                 {
@@ -208,12 +208,12 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
     group = context_->GetReceivers(eventType);
     group = context_->GetReceivers(eventType);
     if (group)
     if (group)
     {
     {
-        unsigned numReceivers = group->size();
-        if (processed.empty())
+        unsigned numReceivers = group->Size();
+        if (processed.Empty())
         {
         {
             for (unsigned k = 0; k < numReceivers; ++k)
             for (unsigned k = 0; k < numReceivers; ++k)
             {
             {
-                Object* receiver = group->at(k);
+                Object* receiver = group->At(k);
                 if (receiver)
                 if (receiver)
                 {
                 {
                     receiver->OnEvent(this, true, eventType, eventData);
                     receiver->OnEvent(this, true, eventType, eventData);
@@ -230,8 +230,8 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
             // If there were specific receivers, check that the event is not sent doubly to them
             // If there were specific receivers, check that the event is not sent doubly to them
             for (unsigned k = 0; k < numReceivers; ++k)
             for (unsigned k = 0; k < numReceivers; ++k)
             {
             {
-                Object* receiver = group->at(k);
-                if ((receiver) && (processed.find(receiver) == processed.end()))
+                Object* receiver = group->At(k);
+                if ((receiver) && (processed.Find(receiver) == processed.End()))
                 {
                 {
                     receiver->OnEvent(this, true, eventType, eventData);
                     receiver->OnEvent(this, true, eventType, eventData);
                     if (self.IsExpired())
                     if (self.IsExpired())
@@ -269,22 +269,22 @@ void Object::SendEvent(Object* receiver, StringHash eventType, VariantMap& event
 
 
 Object* Object::GetSubsystem(ShortStringHash type) const
 Object* Object::GetSubsystem(ShortStringHash type) const
 {
 {
-    const std::map<ShortStringHash, SharedPtr<Object> >& subsystems = context_->GetSubsystems();
-    std::map<ShortStringHash, SharedPtr<Object> >::const_iterator i = subsystems.find(type);
-    if (i != subsystems.end())
-        return i->second;
+    const Map<ShortStringHash, SharedPtr<Object> >& subsystems = context_->GetSubsystems();
+    Map<ShortStringHash, SharedPtr<Object> >::ConstIterator i = subsystems.Find(type);
+    if (i != subsystems.End())
+        return i->second_;
     else
     else
         return 0;
         return 0;
 }
 }
 
 
 bool Object::HasSubscribedToEvent(StringHash eventType) const
 bool Object::HasSubscribedToEvent(StringHash eventType) const
 {
 {
-    return eventHandlers_.find(std::make_pair((Object*)0, eventType)) != eventHandlers_.end();
+    return eventHandlers_.Find(MakePair((Object*)0, eventType)) != eventHandlers_.End();
 }
 }
 
 
 bool Object::HasSubscribedToEvent(Object* sender, StringHash eventType) const
 bool Object::HasSubscribedToEvent(Object* sender, StringHash eventType) const
 {
 {
-    return eventHandlers_.find(std::make_pair(sender, eventType)) != eventHandlers_.end();
+    return eventHandlers_.Find(MakePair(sender, eventType)) != eventHandlers_.End();
 }
 }
 
 
 Object* Object::GetSender() const
 Object* Object::GetSender() const
@@ -294,11 +294,11 @@ Object* Object::GetSender() const
 
 
 void Object::RemoveEventSender(Object* sender)
 void Object::RemoveEventSender(Object* sender)
 {
 {
-    for (std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator i = eventHandlers_.begin();
-        i != eventHandlers_.end();)
+    for (Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator i = eventHandlers_.Begin();
+        i != eventHandlers_.End();)
     {
     {
-        std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> >::iterator current = i++;
-        if (current->first.first == sender)
-            eventHandlers_.erase(current);
+        Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> >::Iterator current = i++;
+        if (current->first_.first_ == sender)
+            eventHandlers_.Erase(current);
     }
     }
 }
 }

+ 1 - 1
Engine/Core/Object.h

@@ -92,7 +92,7 @@ protected:
     
     
 private:
 private:
     /// Event handlers. Sender is null for non-specific handlers
     /// Event handlers. Sender is null for non-specific handlers
-    std::map<std::pair<Object*, StringHash>, SharedPtr<EventHandler> > eventHandlers_;
+    Map<Pair<Object*, StringHash>, SharedPtr<EventHandler> > eventHandlers_;
 };
 };
 
 
 template <class T> SharedPtr<T> Object::CreateObject()
 template <class T> SharedPtr<T> Object::CreateObject()

+ 3 - 3
Engine/Core/Precompiled.h

@@ -25,6 +25,6 @@
 
 
 #include "StringBase.h"
 #include "StringBase.h"
 
 
-#include <map>
-#include <set>
-#include <vector>
+#include "Map.h"
+#include "Set.h"
+#include "Vector.h"

+ 8 - 8
Engine/Core/ProcessUtils.cpp

@@ -43,7 +43,7 @@
 
 
 static bool consoleOpened = false;
 static bool consoleOpened = false;
 static String currentLine;
 static String currentLine;
-static std::vector<String> arguments;
+static Vector<String> arguments;
 static Mutex staticMutex;
 static Mutex staticMutex;
 
 
 void ErrorDialog(const char* title, const char* message)
 void ErrorDialog(const char* title, const char* message)
@@ -53,7 +53,7 @@ void ErrorDialog(const char* title, const char* message)
 
 
 void ErrorExit(const String& message, int exitCode)
 void ErrorExit(const String& message, int exitCode)
 {
 {
-    PrintLine(message);
+    printf("%s", message.CString());
     exit(exitCode);
     exit(exitCode);
 }
 }
 
 
@@ -81,7 +81,7 @@ void OpenConsoleWindow()
 
 
 void PrintLine(const String& str)
 void PrintLine(const String& str)
 {
 {
-    PrintLine(str.CString());
+    printf("%s\n", str.CString());
 }
 }
 
 
 void PrintLine(const char* str)
 void PrintLine(const char* str)
@@ -94,9 +94,9 @@ Mutex& GetStaticMutex()
     return staticMutex;
     return staticMutex;
 }
 }
 
 
-const std::vector<String>& ParseArguments(const char* cmdLine)
+const Vector<String>& ParseArguments(const char* cmdLine)
 {
 {
-    arguments.clear();
+    arguments.Clear();
     
     
     if (!cmdLine)
     if (!cmdLine)
         return arguments;
         return arguments;
@@ -116,7 +116,7 @@ const std::vector<String>& ParseArguments(const char* cmdLine)
             {
             {
                 inCmd = false;
                 inCmd = false;
                 cmdEnd = i;
                 cmdEnd = i;
-                arguments.push_back(cmdStr.Substring(cmdStart, cmdEnd - cmdStart));
+                arguments.Push(cmdStr.Substring(cmdStart, cmdEnd - cmdStart));
             }
             }
         }
         }
         else
         else
@@ -131,13 +131,13 @@ const std::vector<String>& ParseArguments(const char* cmdLine)
     if (inCmd)
     if (inCmd)
     {
     {
         cmdEnd = cmdStr.Length();
         cmdEnd = cmdStr.Length();
-        arguments.push_back(cmdStr.Substring(cmdStart, cmdEnd - cmdStart));
+        arguments.Push(cmdStr.Substring(cmdStart, cmdEnd - cmdStart));
     }
     }
     
     
     return arguments;
     return arguments;
 }
 }
 
 
-const std::vector<String>& GetArguments()
+const Vector<String>& GetArguments()
 {
 {
     return arguments;
     return arguments;
 }
 }

+ 3 - 3
Engine/Core/ProcessUtils.h

@@ -25,7 +25,7 @@
 
 
 #include "StringBase.h"
 #include "StringBase.h"
 
 
-#include <vector>
+#include "Vector.h"
 
 
 class Mutex;
 class Mutex;
 
 
@@ -42,9 +42,9 @@ void PrintLine(const char* str);
 /// Return the static library init/shutdown mutex
 /// Return the static library init/shutdown mutex
 Mutex& GetStaticMutex();
 Mutex& GetStaticMutex();
 /// Parse arguments from the command line
 /// Parse arguments from the command line
-const std::vector<String>& ParseArguments(const char* cmdLine);
+const Vector<String>& ParseArguments(const char* cmdLine);
 /// Return previously parsed arguments
 /// Return previously parsed arguments
-const std::vector<String>& GetArguments();
+const Vector<String>& GetArguments();
 /// Read input from the console window. Return empty if no input
 /// Read input from the console window. Return empty if no input
 String GetConsoleInput();
 String GetConsoleInput();
 /// Return the number of (logical) CPU cores
 /// Return the number of (logical) CPU cores

+ 2 - 2
Engine/Core/Profiler.cpp

@@ -165,8 +165,8 @@ void Profiler::GetData(ProfilerBlock* block, String& output, unsigned indent, bo
         }
         }
     }
     }
     
     
-    const std::vector<ProfilerBlock*>& children = block->GetChildren();
-    for (std::vector<ProfilerBlock*>::const_iterator i = children.begin(); i != children.end(); ++i)
+    const Vector<ProfilerBlock*>& children = block->GetChildren();
+    for (Vector<ProfilerBlock*>::ConstIterator i = children.Begin(); i != children.End(); ++i)
         GetData(*i, output, indent, showUnused, showAccumulated, showTotal);
         GetData(*i, output, indent, showUnused, showAccumulated, showTotal);
 }
 }
 
 

+ 7 - 7
Engine/Core/Profiler.h

@@ -49,7 +49,7 @@ public:
     /// Destruct. Free the child blocks
     /// Destruct. Free the child blocks
     ~ProfilerBlock()
     ~ProfilerBlock()
     {
     {
-        for (std::vector<ProfilerBlock*>::iterator i = children_.begin(); i != children_.end(); ++i)
+        for (Vector<ProfilerBlock*>::Iterator i = children_.Begin(); i != children_.End(); ++i)
         {
         {
             delete *i;
             delete *i;
             *i = 0;
             *i = 0;
@@ -81,7 +81,7 @@ public:
         time_ = 0;
         time_ = 0;
         count_ = 0;
         count_ = 0;
         
         
-        for (std::vector<ProfilerBlock*>::iterator i = children_.begin(); i != children_.end(); ++i)
+        for (Vector<ProfilerBlock*>::Iterator i = children_.Begin(); i != children_.End(); ++i)
             (*i)->EndFrame();
             (*i)->EndFrame();
     }
     }
     
     
@@ -91,7 +91,7 @@ public:
         accumulatedTime_ = 0;
         accumulatedTime_ = 0;
         accumulatedCount_ = 0;
         accumulatedCount_ = 0;
         
         
-        for (std::vector<ProfilerBlock*>::iterator i = children_.begin(); i != children_.end(); ++i)
+        for (Vector<ProfilerBlock*>::Iterator i = children_.Begin(); i != children_.End(); ++i)
             (*i)->ClearAccumulated();
             (*i)->ClearAccumulated();
     }
     }
     
     
@@ -103,7 +103,7 @@ public:
         
         
         lastSearchName_ = name;
         lastSearchName_ = name;
         
         
-        for (std::vector<ProfilerBlock*>::iterator i = children_.begin(); i != children_.end(); ++i)
+        for (Vector<ProfilerBlock*>::Iterator i = children_.Begin(); i != children_.End(); ++i)
         {
         {
             if ((*i)->name_ == name)
             if ((*i)->name_ == name)
             {
             {
@@ -113,7 +113,7 @@ public:
         }
         }
         
         
         ProfilerBlock* newBlock = new ProfilerBlock(this, name);
         ProfilerBlock* newBlock = new ProfilerBlock(this, name);
-        children_.push_back(newBlock);
+        children_.Push(newBlock);
         
         
         lastSearchBlock_ = newBlock;
         lastSearchBlock_ = newBlock;
         return newBlock;
         return newBlock;
@@ -137,7 +137,7 @@ public:
     /// Return parent block
     /// Return parent block
     ProfilerBlock* GetParent() const { return parent_; }
     ProfilerBlock* GetParent() const { return parent_; }
     /// Return child blocks
     /// Return child blocks
-    const std::vector<ProfilerBlock*>& GetChildren() const { return children_; }
+    const Vector<ProfilerBlock*>& GetChildren() const { return children_; }
     
     
 private:
 private:
     /// Block name
     /// Block name
@@ -156,7 +156,7 @@ private:
     /// Parent block
     /// Parent block
     ProfilerBlock* parent_;
     ProfilerBlock* parent_;
     /// Child blocks
     /// Child blocks
-    std::vector<ProfilerBlock*> children_;
+    Vector<ProfilerBlock*> children_;
     
     
     /// Time on the previous frame
     /// Time on the previous frame
     long long frameTime_;
     long long frameTime_;

+ 6 - 2
Engine/Core/SharedArrayPtr.h

@@ -99,10 +99,12 @@ public:
     T& operator * () const { return *ptr_; }
     T& operator * () const { return *ptr_; }
     /// Subscript the array
     /// Subscript the array
     T& operator [] (const int index) { return ptr_[index]; }
     T& operator [] (const int index) { return ptr_[index]; }
-    /// Test for equality with another shared pointer
+    /// Test for equality with another shared array pointer
     bool operator == (const SharedArrayPtr<T>& rhs) const { return ptr_ == rhs.ptr_; }
     bool operator == (const SharedArrayPtr<T>& rhs) const { return ptr_ == rhs.ptr_; }
-    /// Test for inequality with another shared pointer
+    /// Test for inequality with another shared array pointer
     bool operator != (const SharedArrayPtr<T>& rhs) const { return ptr_ != rhs.ptr_; }
     bool operator != (const SharedArrayPtr<T>& rhs) const { return ptr_ != rhs.ptr_; }
+    /// Test for less than with another array pointer
+    bool operator < (const SharedArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     /// Return true if points to an array
     /// Return true if points to an array
     operator bool () const { return ptr_ != 0; }
     operator bool () const { return ptr_ != 0; }
     /// Convert to a raw pointer
     /// Convert to a raw pointer
@@ -310,6 +312,8 @@ public:
     bool operator == (const WeakArrayPtr<T>& rhs) const { return (ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_); }
     bool operator == (const WeakArrayPtr<T>& rhs) const { return (ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_); }
     /// Test for inequality with another weak array pointer
     /// Test for inequality with another weak array pointer
     bool operator != (const WeakArrayPtr<T>& rhs) const { return (ptr_ != rhs.ptr_) || (refCount_ != rhs.refCount_); }
     bool operator != (const WeakArrayPtr<T>& rhs) const { return (ptr_ != rhs.ptr_) || (refCount_ != rhs.refCount_); }
+    /// Test for less than with another weak array pointer
+    bool operator < (const WeakArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     /// Return true if points to an array which is not expired
     /// Return true if points to an array which is not expired
     operator bool () const { return !IsExpired(); }
     operator bool () const { return !IsExpired(); }
     /// Convert to a raw pointer, null if array is expired
     /// Convert to a raw pointer, null if array is expired

+ 4 - 0
Engine/Core/SharedPtr.h

@@ -93,6 +93,8 @@ public:
     T& operator * () const { return *ptr_; }
     T& operator * () const { return *ptr_; }
     /// Subscript the object if applicable
     /// Subscript the object if applicable
     T& operator [] (const int index) { return ptr_[index]; }
     T& operator [] (const int index) { return ptr_[index]; }
+    /// Test for less than with another shared pointer
+    bool operator < (const SharedPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     /// Test for equality with another shared pointer
     /// Test for equality with another shared pointer
     bool operator == (const SharedPtr<T>& rhs) const { return ptr_ == rhs.ptr_; }
     bool operator == (const SharedPtr<T>& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another shared pointer
     /// Test for inequality with another shared pointer
@@ -309,6 +311,8 @@ public:
     bool operator == (const WeakPtr<T>& rhs) const { return (ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_); }
     bool operator == (const WeakPtr<T>& rhs) const { return (ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_); }
     /// Test for inequality with another weak pointer
     /// Test for inequality with another weak pointer
     bool operator != (const WeakPtr<T>& rhs) const { return (ptr_ != rhs.ptr_) || (refCount_ != rhs.refCount_); }
     bool operator != (const WeakPtr<T>& rhs) const { return (ptr_ != rhs.ptr_) || (refCount_ != rhs.refCount_); }
+    /// Test for less than with another weak pointer
+    bool operator < (const SharedPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     /// Return true if points to an object which is not expired
     /// Return true if points to an object which is not expired
     operator bool () const { return !IsExpired(); }
     operator bool () const { return !IsExpired(); }
     /// Convert to a raw pointer, null if the object is expired
     /// Convert to a raw pointer, null if the object is expired

+ 23 - 23
Engine/Core/StringUtils.cpp

@@ -31,9 +31,9 @@
 
 
 static const int TEMP_BUFFER_LENGTH = 128;
 static const int TEMP_BUFFER_LENGTH = 128;
 
 
-std::vector<String> Split(const String& source, char separator)
+Vector<String> Split(const String& source, char separator)
 {
 {
-    std::vector<String> ret;
+    Vector<String> ret;
     unsigned pos = 0;
     unsigned pos = 0;
     
     
     while (pos < source.Length())
     while (pos < source.Length())
@@ -50,7 +50,7 @@ std::vector<String> Split(const String& source, char separator)
         
         
         if (start == source.Length())
         if (start == source.Length())
         {
         {
-            ret.push_back(source.Substring(pos));
+            ret.Push(source.Substring(pos));
             break;
             break;
         }
         }
         
         
@@ -64,7 +64,7 @@ std::vector<String> Split(const String& source, char separator)
             end++;
             end++;
         }
         }
         
         
-        ret.push_back(source.Substring(pos, start - pos));
+        ret.Push(source.Substring(pos, start - pos));
         pos = end;
         pos = end;
     }
     }
     
     
@@ -103,12 +103,12 @@ float ToFloat(const String& source)
 
 
 Color ToColor(const String& source)
 Color ToColor(const String& source)
 {
 {
-    std::vector<String> colors = Split(source, ' ');
-    if (colors.size() < 3)
+    Vector<String> colors = Split(source, ' ');
+    if (colors.Size() < 3)
         return Color();
         return Color();
     
     
     Color ret(ToFloat(colors[0]), ToFloat(colors[1]), ToFloat(colors[2]));
     Color ret(ToFloat(colors[0]), ToFloat(colors[1]), ToFloat(colors[2]));
-    if (colors.size() > 3)
+    if (colors.Size() > 3)
         ret.a_ = ToFloat(colors[3]);
         ret.a_ = ToFloat(colors[3]);
     
     
     return ret;
     return ret;
@@ -116,8 +116,8 @@ Color ToColor(const String& source)
 
 
 IntRect ToIntRect(const String& source)
 IntRect ToIntRect(const String& source)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
-    if (coords.size() < 4)
+    Vector<String> coords = Split(source, ' ');
+    if (coords.Size() < 4)
         return IntRect::ZERO;
         return IntRect::ZERO;
     else
     else
         return IntRect(ToInt(coords[0]), ToInt(coords[1]), ToInt(coords[2]), ToInt(coords[3]));
         return IntRect(ToInt(coords[0]), ToInt(coords[1]), ToInt(coords[2]), ToInt(coords[3]));
@@ -125,8 +125,8 @@ IntRect ToIntRect(const String& source)
 
 
 IntVector2 ToIntVector2(const String& source)
 IntVector2 ToIntVector2(const String& source)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
-    if (coords.size() < 2)
+    Vector<String> coords = Split(source, ' ');
+    if (coords.Size() < 2)
         return IntVector2::ZERO;
         return IntVector2::ZERO;
     else
     else
         return IntVector2(ToInt(coords[0]), ToInt(coords[1]));
         return IntVector2(ToInt(coords[0]), ToInt(coords[1]));
@@ -134,8 +134,8 @@ IntVector2 ToIntVector2(const String& source)
 
 
 Rect ToRect(const String& source)
 Rect ToRect(const String& source)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
-    if (coords.size() < 4)
+    Vector<String> coords = Split(source, ' ');
+    if (coords.Size() < 4)
         return Rect::ZERO;
         return Rect::ZERO;
     else
     else
         return Rect(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]), ToFloat(coords[3]));
         return Rect(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]), ToFloat(coords[3]));
@@ -143,10 +143,10 @@ Rect ToRect(const String& source)
 
 
 Quaternion ToQuaternion(const String& source)
 Quaternion ToQuaternion(const String& source)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
-    if (coords.size() < 3)
+    Vector<String> coords = Split(source, ' ');
+    if (coords.Size() < 3)
         return Quaternion::IDENTITY;
         return Quaternion::IDENTITY;
-    else if (coords.size() < 4)
+    else if (coords.Size() < 4)
         // 3 coords specified: conversion from Euler angles
         // 3 coords specified: conversion from Euler angles
         return Quaternion(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]));
         return Quaternion(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]));
     else
     else
@@ -156,8 +156,8 @@ Quaternion ToQuaternion(const String& source)
 
 
 Vector2 ToVector2(const String& source)
 Vector2 ToVector2(const String& source)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
-    if (coords.size() < 2)
+    Vector<String> coords = Split(source, ' ');
+    if (coords.Size() < 2)
         return Vector2::ZERO;
         return Vector2::ZERO;
     else
     else
         return Vector2(ToFloat(coords[0]), ToFloat(coords[1]));
         return Vector2(ToFloat(coords[0]), ToFloat(coords[1]));
@@ -165,8 +165,8 @@ Vector2 ToVector2(const String& source)
 
 
 Vector3 ToVector3(const String& source)
 Vector3 ToVector3(const String& source)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
-    if (coords.size() < 3)
+    Vector<String> coords = Split(source, ' ');
+    if (coords.Size() < 3)
         return Vector3::ZERO;
         return Vector3::ZERO;
     else
     else
         return Vector3(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]));
         return Vector3(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]));
@@ -174,17 +174,17 @@ Vector3 ToVector3(const String& source)
 
 
 Vector4 ToVector4(const String& source, bool allowMissingCoords)
 Vector4 ToVector4(const String& source, bool allowMissingCoords)
 {
 {
-    std::vector<String> coords = Split(source, ' ');
+    Vector<String> coords = Split(source, ' ');
     if (!allowMissingCoords)
     if (!allowMissingCoords)
     {
     {
-        if (coords.size() < 4)
+        if (coords.Size() < 4)
             return Vector4::ZERO;
             return Vector4::ZERO;
         
         
         return Vector4(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]), ToFloat(coords[3]));
         return Vector4(ToFloat(coords[0]), ToFloat(coords[1]), ToFloat(coords[2]), ToFloat(coords[3]));
     }
     }
     else
     else
     {
     {
-        unsigned num = coords.size();
+        unsigned num = coords.Size();
         Vector4 ret(Vector4::ZERO);
         Vector4 ret(Vector4::ZERO);
         if (num > 0)
         if (num > 0)
             ret.x_ = ToFloat(coords[0]);
             ret.x_ = ToFloat(coords[0]);

+ 2 - 2
Engine/Core/StringUtils.h

@@ -29,10 +29,10 @@
 #include "StringHash.h"
 #include "StringHash.h"
 #include "Vector4.h"
 #include "Vector4.h"
 
 
-#include <vector>
+#include "Vector.h"
 
 
 /// Split string with a separator char
 /// Split string with a separator char
-std::vector<String> Split(const String& source, char separator);
+Vector<String> Split(const String& source, char separator);
 /// Parse a bool from a string. Check for the substring "true" case-insensitively
 /// Parse a bool from a string. Check for the substring "true" case-insensitively
 bool ToBool(const String& source);
 bool ToBool(const String& source);
 /// Parse a float from a string
 /// Parse a float from a string

+ 22 - 22
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 std::vector<unsigned char> Variant::emptyBuffer;
+const Vector<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<std::vector<unsigned char>*>(value_.ptr_)) = *(reinterpret_cast<const std::vector<unsigned char>*>(rhs.value_.ptr_));
+        *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_)) = *(reinterpret_cast<const Vector<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 std::vector<unsigned char>*>(value_.ptr_)) == *(reinterpret_cast<const std::vector<unsigned char>*>(rhs.value_.ptr_));
+        return *(reinterpret_cast<const Vector<unsigned char>*>(value_.ptr_)) == *(reinterpret_cast<const Vector<unsigned char>*>(rhs.value_.ptr_));
         
         
     case VAR_PTR:
     case VAR_PTR:
         return value_.ptr_ == rhs.value_.ptr_;
         return value_.ptr_ == rhs.value_.ptr_;
@@ -178,10 +178,10 @@ void Variant::FromString(const String& type, const String& value)
     else if (typeLower == "buffer")
     else if (typeLower == "buffer")
     {
     {
         SetType(VAR_BUFFER);
         SetType(VAR_BUFFER);
-        std::vector<unsigned char>& buffer = *(reinterpret_cast<std::vector<unsigned char>*>(value_.ptr_));
-        std::vector<String> values = Split(value, ' ');
-        buffer.resize(values.size());
-        for (unsigned i = 0; i < values.size(); ++i)
+        Vector<unsigned char>& buffer = *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_));
+        Vector<String> values = Split(value, ' ');
+        buffer.Resize(values.Size());
+        for (unsigned i = 0; i < values.Size(); ++i)
             buffer[i] = ToInt(values[i]);
             buffer[i] = ToInt(values[i]);
     }
     }
     else if (typeLower == "pointer")
     else if (typeLower == "pointer")
@@ -190,8 +190,8 @@ void Variant::FromString(const String& type, const String& value)
     }
     }
     else if (typeLower == "objectref")
     else if (typeLower == "objectref")
     {
     {
-        std::vector<String> values = Split(value, ';');
-        if (values.size() == 2)
+        Vector<String> values = Split(value, ';');
+        if (values.Size() == 2)
         {
         {
             SetType(VAR_RESOURCEREF);
             SetType(VAR_RESOURCEREF);
             ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(value_.ptr_));
             ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(value_.ptr_));
@@ -201,14 +201,14 @@ void Variant::FromString(const String& type, const String& value)
     }
     }
     else if (typeLower == "objectreflist")
     else if (typeLower == "objectreflist")
     {
     {
-        std::vector<String> values = Split(value, ';');
-        if (values.size() >= 1)
+        Vector<String> values = Split(value, ';');
+        if (values.Size() >= 1)
         {
         {
             SetType(VAR_RESOURCEREFLIST);
             SetType(VAR_RESOURCEREFLIST);
             ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(value_.ptr_));
             ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(value_.ptr_));
             refList.type_ = ShortStringHash(values[0]);
             refList.type_ = ShortStringHash(values[0]);
-            refList.ids_.resize(values.size() - 1);
-            for (unsigned i = 1; i < values.size(); ++i)
+            refList.ids_.Resize(values.Size() - 1);
+            for (unsigned i = 1; i < values.Size(); ++i)
                 refList.ids_[i - 1] = StringHash(values[i]);
                 refList.ids_[i - 1] = StringHash(values[i]);
         }
         }
     }
     }
@@ -222,8 +222,8 @@ void Variant::SetBuffer(const void* data, unsigned size)
         size = 0;
         size = 0;
     
     
     SetType(VAR_BUFFER);
     SetType(VAR_BUFFER);
-    std::vector<unsigned char>& buffer = *(reinterpret_cast<std::vector<unsigned char>*>(value_.ptr_));
-    buffer.resize(size);
+    Vector<unsigned char>& buffer = *(reinterpret_cast<Vector<unsigned char>*>(value_.ptr_));
+    buffer.Resize(size);
     if (size)
     if (size)
         memcpy(&buffer[0], data, size);
         memcpy(&buffer[0], data, size);
 }
 }
@@ -266,11 +266,11 @@ String Variant::ToString() const
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
         {
         {
-            const std::vector<unsigned char>& buffer = *(reinterpret_cast<const std::vector<unsigned char>*>(value_.ptr_));
+            const Vector<unsigned char>& buffer = *(reinterpret_cast<const Vector<unsigned char>*>(value_.ptr_));
             String ret;
             String ret;
-            for (std::vector<unsigned char>::const_iterator i = buffer.begin(); i != buffer.end(); ++i)
+            for (Vector<unsigned char>::ConstIterator i = buffer.Begin(); i != buffer.End(); ++i)
             {
             {
-                if (i != buffer.begin())
+                if (i != buffer.Begin())
                     ret += " ";
                     ret += " ";
                 ret += ::ToString(*i);
                 ret += ::ToString(*i);
             }
             }
@@ -305,7 +305,7 @@ void Variant::SetType(VariantType newType)
         break;
         break;
         
         
     case VAR_BUFFER:
     case VAR_BUFFER:
-        delete reinterpret_cast<std::vector<unsigned char>*>(value_.ptr_);
+        delete reinterpret_cast<Vector<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<std::vector<unsigned char>**>(&value_.ptr_) = new std::vector<unsigned char>();
+        *reinterpret_cast<Vector<unsigned char>**>(&value_.ptr_) = new Vector<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 std::vector<unsigned char>& Variant::Get<const std::vector<unsigned char>& >() const
+template<> const Vector<unsigned char>& Variant::Get<const Vector<unsigned char>& >() const
 {
 {
     return GetBuffer();
     return GetBuffer();
 }
 }
@@ -475,7 +475,7 @@ template<> String Variant::Get<String>() const
     return GetString();
     return GetString();
 }
 }
 
 
-template<> std::vector<unsigned char> Variant::Get<std::vector<unsigned char> >() const
+template<> Vector<unsigned char> Variant::Get<Vector<unsigned char> >() const
 {
 {
     return GetBuffer();
     return GetBuffer();
 }
 }

+ 15 - 15
Engine/Core/Variant.h

@@ -28,8 +28,8 @@
 #include "StringHash.h"
 #include "StringHash.h"
 #include "Vector4.h"
 #include "Vector4.h"
 
 
-#include <map>
-#include <vector>
+#include "Map.h"
+#include "Vector.h"
 
 
 /// Supported variable types for Variant
 /// Supported variable types for Variant
 enum VariantType
 enum VariantType
@@ -128,7 +128,7 @@ struct ResourceRefList
     {
     {
     }
     }
     /// Construct with type and id list
     /// Construct with type and id list
-    ResourceRefList(ShortStringHash type, const std::vector<StringHash>& ids) :
+    ResourceRefList(ShortStringHash type, const Vector<StringHash>& ids) :
         type_(type),
         type_(type),
         ids_(ids)
         ids_(ids)
     {
     {
@@ -137,7 +137,7 @@ struct ResourceRefList
     /// Object type
     /// Object type
     ShortStringHash type_;
     ShortStringHash type_;
     /// List of object identifiers, for example name hashes
     /// List of object identifiers, for example name hashes
-    std::vector<StringHash> ids_;
+    Vector<StringHash> ids_;
     
     
     /// Test for equality with another reference list
     /// Test for equality with another reference list
     bool operator == (const ResourceRefList& rhs) const
     bool operator == (const ResourceRefList& rhs) const
@@ -155,9 +155,9 @@ struct ResourceRefList
 class Variant;
 class Variant;
 
 
 /// Vector of variants
 /// Vector of variants
-typedef std::vector<Variant> VariantVector;
+typedef Vector<Variant> VariantVector;
 /// Map of variants
 /// Map of variants
-typedef std::map<ShortStringHash, Variant> VariantMap;
+typedef Map<ShortStringHash, Variant> VariantMap;
 
 
 /// Variable that supports a fixed set of types
 /// Variable that supports a fixed set of types
 class Variant
 class Variant
@@ -261,7 +261,7 @@ public:
     }
     }
     
     
     /// Construct from a buffer
     /// Construct from a buffer
-    Variant(const std::vector<unsigned char>& value) :
+    Variant(const Vector<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 std::vector<unsigned char>& rhs)
+    Variant& operator = (const Vector<unsigned char>& rhs)
     {
     {
         SetType(VAR_BUFFER);
         SetType(VAR_BUFFER);
-        *(reinterpret_cast<std::vector<unsigned char>*>(value_.ptr_)) = rhs;
+        *(reinterpret_cast<Vector<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 std::vector<unsigned char>& rhs) const
+    bool operator == (const Vector<unsigned char>& rhs) const
     {
     {
         if (type_ == VAR_BUFFER)
         if (type_ == VAR_BUFFER)
-            return *(reinterpret_cast<const std::vector<unsigned char>*>(value_.ptr_)) == rhs;
+            return *(reinterpret_cast<const Vector<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 std::vector<unsigned char>& rhs) const { return !(*this == rhs); }
+    bool operator != (const Vector<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 std::vector<unsigned char>& GetBuffer() const
+    const Vector<unsigned char>& GetBuffer() const
     {
     {
         if (type_ != VAR_BUFFER)
         if (type_ != VAR_BUFFER)
             return emptyBuffer;
             return emptyBuffer;
-        return *reinterpret_cast<const std::vector<unsigned char>*>(value_.ptr_);
+        return *reinterpret_cast<const Vector<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 std::vector<unsigned char> emptyBuffer;
+    static const Vector<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

+ 31 - 31
Engine/Engine/APITemplates.h

@@ -37,7 +37,7 @@
 
 
 #include <angelscript.h>
 #include <angelscript.h>
 #include <cstring>
 #include <cstring>
-#include <set>
+#include "Set.h"
 
 
 /// Template function for dynamic cast between two script classes
 /// Template function for dynamic cast between two script classes
 template <class T, class U> U* RefCast(T* t)
 template <class T, class U> U* RefCast(T* t)
@@ -60,14 +60,14 @@ template <class T> T* GetVariantPtr(Variant* ptr)
         return 0;
         return 0;
 }
 }
 
 
-/// Template function for std::vector to array conversion
-template <class T> CScriptArray* VectorToArray(const std::vector<T>& vector, const char* arrayName)
+/// Template function for Vector to array conversion
+template <class T> CScriptArray* VectorToArray(const Vector<T>& vector, const char* arrayName)
 {
 {
     asIScriptContext *context = asGetActiveContext();
     asIScriptContext *context = asGetActiveContext();
     if (context)
     if (context)
     {
     {
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
-        CScriptArray* arr = new CScriptArray(vector.size(), type);
+        CScriptArray* arr = new CScriptArray(vector.Size(), type);
         
         
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         for (unsigned i = 0; i < arr->GetSize(); ++i)
             *(static_cast<T*>(arr->At(i))) = vector[i];
             *(static_cast<T*>(arr->At(i))) = vector[i];
@@ -78,14 +78,14 @@ template <class T> CScriptArray* VectorToArray(const std::vector<T>& vector, con
         return 0;
         return 0;
 }
 }
 
 
-/// Template function for std::vector to handle array conversion
-template <class T> CScriptArray* VectorToHandleArray(const std::vector<T*>& vector, const char* arrayName)
+/// Template function for Vector to handle array conversion
+template <class T> CScriptArray* VectorToHandleArray(const Vector<T*>& vector, const char* arrayName)
 {
 {
     asIScriptContext *context = asGetActiveContext();
     asIScriptContext *context = asGetActiveContext();
     if (context)
     if (context)
     {
     {
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
-        CScriptArray* arr = new CScriptArray(vector.size(), type);
+        CScriptArray* arr = new CScriptArray(vector.Size(), type);
         
         
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         {
         {
@@ -101,14 +101,14 @@ template <class T> CScriptArray* VectorToHandleArray(const std::vector<T*>& vect
         return 0;
         return 0;
 }
 }
 
 
-/// Template function for shared pointer std::vector to handle array conversion
-template <class T> CScriptArray* SharedPtrVectorToHandleArray(const std::vector<SharedPtr<T> >& vector, const char* arrayName)
+/// Template function for shared pointer Vector to handle array conversion
+template <class T> CScriptArray* SharedPtrVectorToHandleArray(const Vector<SharedPtr<T> >& vector, const char* arrayName)
 {
 {
     asIScriptContext *context = asGetActiveContext();
     asIScriptContext *context = asGetActiveContext();
     if (context)
     if (context)
     {
     {
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
-        CScriptArray* arr = new CScriptArray(vector.size(), type);
+        CScriptArray* arr = new CScriptArray(vector.Size(), type);
         
         
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         {
         {
@@ -124,17 +124,17 @@ template <class T> CScriptArray* SharedPtrVectorToHandleArray(const std::vector<
         return 0;
         return 0;
 }
 }
 
 
-/// Template function for std::set to array conversion
-template <class T> CScriptArray* SetToArray(const std::set<T>& set, const char* arrayName)
+/// Template function for Set to array conversion
+template <class T> CScriptArray* SetToArray(const Set<T>& set, const char* arrayName)
 {
 {
     asIScriptContext *context = asGetActiveContext();
     asIScriptContext *context = asGetActiveContext();
     if (context)
     if (context)
     {
     {
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
         asIObjectType* type = GetScriptContext()->GetSubsystem<Script>()->GetObjectType(arrayName);
-        CScriptArray* arr = new CScriptArray(set.size(), type);
+        CScriptArray* arr = new CScriptArray(set.Size(), type);
         
         
         unsigned index = 0;
         unsigned index = 0;
-        for (typename std::set<T>::const_iterator i = set.begin(); i != set.end(); ++i)
+        for (typename Set<T>::ConstIterator i = set.Begin(); i != set.End(); ++i)
         {
         {
             *(static_cast<T*>(arr->At(index))) = *i;
             *(static_cast<T*>(arr->At(index))) = *i;
             ++index;
             ++index;
@@ -276,14 +276,14 @@ static const AttributeInfo noAttributeInfo;
 
 
 static const AttributeInfo& SerializableGetAttributeInfo(unsigned index, Serializable* ptr)
 static const AttributeInfo& SerializableGetAttributeInfo(unsigned index, Serializable* ptr)
 {
 {
-    const std::vector<AttributeInfo>* attributes = ptr->GetAttributes();
-    if ((!attributes) || (index >= attributes->size()))
+    const Vector<AttributeInfo>* attributes = ptr->GetAttributes();
+    if ((!attributes) || (index >= attributes->Size()))
     {
     {
         asGetActiveContext()->SetException("Index out of bounds");
         asGetActiveContext()->SetException("Index out of bounds");
         return noAttributeInfo;
         return noAttributeInfo;
     }
     }
     else
     else
-        return attributes->at(index);
+        return attributes->At(index);
 }
 }
 
 
 static bool SerializableLoad(File* file, Serializable* ptr)
 static bool SerializableLoad(File* file, Serializable* ptr)
@@ -342,8 +342,8 @@ static Component* NodeGetOrCreateComponent(const String& typeName, bool local, N
 
 
 static Component* NodeGetComponent(unsigned index, Node* ptr)
 static Component* NodeGetComponent(unsigned index, Node* ptr)
 {
 {
-    const std::vector<SharedPtr<Component> >& components = ptr->GetComponents();
-    if (index >= components.size())
+    const Vector<SharedPtr<Component> >& components = ptr->GetComponents();
+    if (index >= components.Size())
     {
     {
         asGetActiveContext()->SetException("Index out of bounds");
         asGetActiveContext()->SetException("Index out of bounds");
         return 0;
         return 0;
@@ -359,7 +359,7 @@ static Component* NodeGetComponentWithTypeAndIndex(const String& typeName, unsig
 
 
 static CScriptArray* NodeGetComponentsWithType(const String& typeName, Node* ptr)
 static CScriptArray* NodeGetComponentsWithType(const String& typeName, Node* ptr)
 {
 {
-    std::vector<Component*> components;
+    Vector<Component*> components;
     ptr->GetComponents(components, ShortStringHash(typeName));
     ptr->GetComponents(components, ShortStringHash(typeName));
     return VectorToHandleArray<Component>(components, "Array<Component@>");
     return VectorToHandleArray<Component>(components, "Array<Component@>");
 }
 }
@@ -371,14 +371,14 @@ static bool NodeHasComponent(const String& typeName, Node* ptr)
 
 
 static CScriptArray* NodeGetChildren(bool recursive, Node* ptr)
 static CScriptArray* NodeGetChildren(bool recursive, Node* ptr)
 {
 {
-    std::vector<Node*> nodes;
+    Vector<Node*> nodes;
     ptr->GetChildren(nodes, recursive);
     ptr->GetChildren(nodes, recursive);
     return VectorToHandleArray<Node>(nodes, "Array<Node@>");
     return VectorToHandleArray<Node>(nodes, "Array<Node@>");
 }
 }
 
 
 static CScriptArray* NodeGetChildrenWithComponent(String& typeName, bool recursive, Node* ptr)
 static CScriptArray* NodeGetChildrenWithComponent(String& typeName, bool recursive, Node* ptr)
 {
 {
-    std::vector<Node*> nodes;
+    Vector<Node*> nodes;
     ptr->GetChildrenWithComponent(nodes, ShortStringHash(typeName), recursive);
     ptr->GetChildrenWithComponent(nodes, ShortStringHash(typeName), recursive);
     return VectorToHandleArray<Node>(nodes, "Array<Node@>");
     return VectorToHandleArray<Node>(nodes, "Array<Node@>");
 }
 }
@@ -395,8 +395,8 @@ static unsigned NodeGetNumChildrenRecursive(Node* ptr)
 
 
 static Node* NodeGetChild(unsigned index, Node* ptr)
 static Node* NodeGetChild(unsigned index, Node* ptr)
 {
 {
-    const std::vector<SharedPtr<Node> >& children = ptr->GetChildren();
-    if (index >= children.size())
+    const Vector<SharedPtr<Node> >& children = ptr->GetChildren();
+    if (index >= children.Size())
     {
     {
         asGetActiveContext()->SetException("Index out of bounds");
         asGetActiveContext()->SetException("Index out of bounds");
         return 0;
         return 0;
@@ -407,28 +407,28 @@ static Node* NodeGetChild(unsigned index, Node* ptr)
 
 
 static CScriptArray* NodeGetScriptedChildren(bool recursive, Node* ptr)
 static CScriptArray* NodeGetScriptedChildren(bool recursive, Node* ptr)
 {
 {
-    std::vector<Node*> nodes;
+    Vector<Node*> nodes;
     ptr->GetChildrenWithComponent<ScriptInstance>(nodes, recursive);
     ptr->GetChildrenWithComponent<ScriptInstance>(nodes, recursive);
     return VectorToHandleArray<Node>(nodes, "Array<Node@>");
     return VectorToHandleArray<Node>(nodes, "Array<Node@>");
 }
 }
 
 
 static CScriptArray* NodeGetScriptedChildrenWithClassName(const String& className, bool recursive, Node* ptr)
 static CScriptArray* NodeGetScriptedChildrenWithClassName(const String& className, bool recursive, Node* ptr)
 {
 {
-    std::vector<Node*> nodes;
-    std::vector<Node*> ret;
+    Vector<Node*> nodes;
+    Vector<Node*> ret;
     
     
     ptr->GetChildrenWithComponent<ScriptInstance>(nodes, recursive);
     ptr->GetChildrenWithComponent<ScriptInstance>(nodes, recursive);
-    for (std::vector<Node*>::iterator i = nodes.begin(); i != nodes.end(); ++i)
+    for (Vector<Node*>::Iterator i = nodes.Begin(); i != nodes.End(); ++i)
     {
     {
         Node* node = (*i);
         Node* node = (*i);
-        const std::vector<SharedPtr<Component> >& components = node->GetComponents();
-        for (std::vector<SharedPtr<Component> >::const_iterator j = components.begin(); j != components.end(); ++j)
+        const Vector<SharedPtr<Component> >& components = node->GetComponents();
+        for (Vector<SharedPtr<Component> >::ConstIterator j = components.Begin(); j != components.End(); ++j)
         {
         {
             if ((*j)->GetType() == ScriptInstance::GetTypeStatic())
             if ((*j)->GetType() == ScriptInstance::GetTypeStatic())
             {
             {
                 ScriptInstance* instance = static_cast<ScriptInstance*>(j->GetPtr());
                 ScriptInstance* instance = static_cast<ScriptInstance*>(j->GetPtr());
                 if (instance->GetClassName() == className)
                 if (instance->GetClassName() == className)
-                    ret.push_back(node);
+                    ret.Push(node);
             }
             }
         }
         }
     }
     }

+ 16 - 16
Engine/Engine/Console.cpp

@@ -98,7 +98,7 @@ void Console::SetStyle(XMLFile* style)
     style_ = style;
     style_ = style;
     background_->SetStyle(style, "ConsoleBackground");
     background_->SetStyle(style, "ConsoleBackground");
     
     
-    for (unsigned i = 0; i < rows_.size(); ++i)
+    for (unsigned i = 0; i < rows_.Size(); ++i)
         rows_[i]->SetStyle(style, "ConsoleText");
         rows_[i]->SetStyle(style, "ConsoleText");
     
     
     lineEdit_->SetStyle(style, "ConsoleLineEdit");
     lineEdit_->SetStyle(style, "ConsoleLineEdit");
@@ -127,8 +127,8 @@ void Console::SetNumRows(unsigned rows)
     
     
     rowContainer_->RemoveAllChildren();
     rowContainer_->RemoveAllChildren();
     
     
-    rows_.resize(rows);
-    for (unsigned i = 0; i < rows_.size(); ++i)
+    rows_.Resize(rows);
+    for (unsigned i = 0; i < rows_.Size(); ++i)
     {
     {
         if (!rows_[i])
         if (!rows_[i])
         {
         {
@@ -144,8 +144,8 @@ void Console::SetNumRows(unsigned rows)
 void Console::SetNumHistoryRows(unsigned rows)
 void Console::SetNumHistoryRows(unsigned rows)
 {
 {
     historyRows_ = rows;
     historyRows_ = rows;
-    if (history_.size() > rows)
-        history_.resize(rows);
+    if (history_.Size() > rows)
+        history_.Resize(rows);
     if (historyPosition_ > rows)
     if (historyPosition_ > rows)
         historyPosition_ = rows;
         historyPosition_ = rows;
 }
 }
@@ -168,7 +168,7 @@ bool Console::IsVisible() const
 
 
 const String& Console::GetHistoryRow(unsigned index) const
 const String& Console::GetHistoryRow(unsigned index) const
 {
 {
-    return index < history_.size() ? history_[index] : noRow;
+    return index < history_.Size() ? history_[index] : noRow;
 }
 }
 
 
 void Console::HandleTextFinished(StringHash eventType, VariantMap& eventData)
 void Console::HandleTextFinished(StringHash eventType, VariantMap& eventData)
@@ -183,10 +183,10 @@ void Console::HandleTextFinished(StringHash eventType, VariantMap& eventData)
             script->Execute(line);
             script->Execute(line);
         
         
         // Store to history, then clear the lineedit
         // Store to history, then clear the lineedit
-        history_.push_back(line);
-        if (history_.size() > historyRows_)
-            history_.erase(history_.begin());
-        historyPosition_ = history_.size();
+        history_.Push(line);
+        if (history_.Size() > historyRows_)
+            history_.Erase(history_.Begin());
+        historyPosition_ = history_.Size();
         
         
         current_Row.Clear();
         current_Row.Clear();
         lineEdit_->SetText(current_Row);
         lineEdit_->SetText(current_Row);
@@ -207,7 +207,7 @@ void Console::HandleLineEditKey(StringHash eventType, VariantMap& eventData)
     case KEY_UP:
     case KEY_UP:
         if (historyPosition_ > 0)
         if (historyPosition_ > 0)
         {
         {
-            if (historyPosition_ == history_.size())
+            if (historyPosition_ == history_.Size())
                 current_Row = lineEdit_->GetText();
                 current_Row = lineEdit_->GetText();
             --historyPosition_;
             --historyPosition_;
             changed = true;
             changed = true;
@@ -215,7 +215,7 @@ void Console::HandleLineEditKey(StringHash eventType, VariantMap& eventData)
         break;
         break;
     
     
     case KEY_DOWN:
     case KEY_DOWN:
-        if (historyPosition_ < history_.size())
+        if (historyPosition_ < history_.Size())
         {
         {
             ++historyPosition_;
             ++historyPosition_;
             changed = true;
             changed = true;
@@ -225,7 +225,7 @@ void Console::HandleLineEditKey(StringHash eventType, VariantMap& eventData)
     
     
     if (changed)
     if (changed)
     {
     {
-        if (historyPosition_ < history_.size())
+        if (historyPosition_ < history_.Size())
             lineEdit_->SetText(history_[historyPosition_]);
             lineEdit_->SetText(history_[historyPosition_]);
         else
         else
             lineEdit_->SetText(current_Row);
             lineEdit_->SetText(current_Row);
@@ -240,7 +240,7 @@ void Console::HandleScreenMode(StringHash eventType, VariantMap& eventData)
 void Console::HandleLogMessage(StringHash eventType, VariantMap& eventData)
 void Console::HandleLogMessage(StringHash eventType, VariantMap& eventData)
 {
 {
     // If the rows are not fully initialized yet, or we are recursing here, do not write the message
     // If the rows are not fully initialized yet, or we are recursing here, do not write the message
-    if ((inLogMessage_) || (!rows_.size()) || (!rows_[rows_.size() - 1]))
+    if ((inLogMessage_) || (!rows_.Size()) || (!rows_[rows_.Size() - 1]))
         return;
         return;
     
     
     inLogMessage_ = true;
     inLogMessage_ = true;
@@ -248,8 +248,8 @@ void Console::HandleLogMessage(StringHash eventType, VariantMap& eventData)
     using namespace LogMessage;
     using namespace LogMessage;
     
     
     // Be prepared for possible multi-line messages
     // Be prepared for possible multi-line messages
-    std::vector<String> rows = Split(eventData[P_MESSAGE].GetString(), '\n');
-    for (unsigned i = 0; i < rows.size(); ++i)
+    Vector<String> rows = Split(eventData[P_MESSAGE].GetString(), '\n');
+    for (unsigned i = 0; i < rows.Size(); ++i)
     {
     {
         // Remove the first row, change its text and re-add to the bottom
         // Remove the first row, change its text and re-add to the bottom
         Text* text = static_cast<Text*>(rowContainer_->GetChild(0));
         Text* text = static_cast<Text*>(rowContainer_->GetChild(0));

+ 3 - 3
Engine/Engine/Console.h

@@ -66,7 +66,7 @@ public:
     /// Return whether is visible
     /// Return whether is visible
     bool IsVisible() const;
     bool IsVisible() const;
     /// Return number of displayed rows
     /// Return number of displayed rows
-    unsigned GetNumRows() const { return rows_.size(); }
+    unsigned GetNumRows() const { return rows_.Size(); }
     /// Return history maximum size
     /// Return history maximum size
     unsigned GetNumHistoryRows() const { return historyRows_; }
     unsigned GetNumHistoryRows() const { return historyRows_; }
     /// Return current history position
     /// Return current history position
@@ -91,11 +91,11 @@ private:
     /// Container for text rows
     /// Container for text rows
     SharedPtr<UIElement> rowContainer_;
     SharedPtr<UIElement> rowContainer_;
     /// Text rows
     /// Text rows
-    std::vector<SharedPtr<Text> > rows_;
+    Vector<SharedPtr<Text> > rows_;
     /// Line edit
     /// Line edit
     SharedPtr<LineEdit> lineEdit_;
     SharedPtr<LineEdit> lineEdit_;
     /// Command history
     /// Command history
-    std::vector<String> history_;
+    Vector<String> history_;
     /// Current row being edited
     /// Current row being edited
     String current_Row;
     String current_Row;
     /// Command history maximum rows
     /// Command history maximum rows

+ 13 - 13
Engine/Engine/CoreAPI.cpp

@@ -135,22 +135,22 @@ static void DestructResourceRefList(ResourceRefList* ptr)
 
 
 static void ResourceRefListResize(unsigned size, ResourceRefList* ptr)
 static void ResourceRefListResize(unsigned size, ResourceRefList* ptr)
 {
 {
-    ptr->ids_.resize(size);
+    ptr->ids_.Resize(size);
 }
 }
 
 
 static unsigned ResourceRefListGetSize(ResourceRefList* ptr)
 static unsigned ResourceRefListGetSize(ResourceRefList* ptr)
 {
 {
-    return ptr->ids_.size();
+    return ptr->ids_.Size();
 }
 }
 
 
 static bool ResourceRefListIsEmpty(ResourceRefList* ptr)
 static bool ResourceRefListIsEmpty(ResourceRefList* ptr)
 {
 {
-    return ptr->ids_.size() == 0;
+    return ptr->ids_.Size() == 0;
 }
 }
 
 
 static void ResourceRefListSetId(unsigned index, const StringHash& id, ResourceRefList* ptr)
 static void ResourceRefListSetId(unsigned index, const StringHash& id, ResourceRefList* ptr)
 {
 {
-    if (index >= ptr->ids_.size())
+    if (index >= ptr->ids_.Size())
     {
     {
         asGetActiveContext()->SetException("Index out of bounds");
         asGetActiveContext()->SetException("Index out of bounds");
         return;
         return;
@@ -161,7 +161,7 @@ static void ResourceRefListSetId(unsigned index, const StringHash& id, ResourceR
 
 
 static StringHash ResourceRefListGetId(unsigned index, ResourceRefList* ptr)
 static StringHash ResourceRefListGetId(unsigned index, ResourceRefList* ptr)
 {
 {
-    if (index >= ptr->ids_.size())
+    if (index >= ptr->ids_.Size())
     {
     {
         asGetActiveContext()->SetException("Index out of bounds");
         asGetActiveContext()->SetException("Index out of bounds");
         return StringHash();
         return StringHash();
@@ -243,7 +243,7 @@ static void ConstructVariantString(const String& value, Variant* ptr)
 void ArrayToVariantVector(CScriptArray* arr, VariantVector& dest)
 void ArrayToVariantVector(CScriptArray* arr, VariantVector& dest)
 {
 {
     unsigned numVariants = arr->GetSize();
     unsigned numVariants = arr->GetSize();
-    dest.resize(numVariants);
+    dest.Resize(numVariants);
     for (unsigned i = 0; i < numVariants; ++i)
     for (unsigned i = 0; i < numVariants; ++i)
         dest[i] = *(static_cast<Variant*>(arr->At(i)));
         dest[i] = *(static_cast<Variant*>(arr->At(i)));
 }
 }
@@ -307,12 +307,12 @@ static Variant& VariantMapAt(const String& key, VariantMap& map)
 
 
 static bool VariantMapContains(const String& key, VariantMap& map)
 static bool VariantMapContains(const String& key, VariantMap& map)
 {
 {
-    return map.find(ShortStringHash(key)) != map.end();
+    return map.Find(ShortStringHash(key)) != map.End();
 }
 }
 
 
 static void VariantMapErase(const String& key, VariantMap& map)
 static void VariantMapErase(const String& key, VariantMap& map)
 {
 {
-    map.erase(ShortStringHash(key));
+    map.Erase(ShortStringHash(key));
 }
 }
 
 
 static void RegisterVariant(asIScriptEngine* engine)
 static void RegisterVariant(asIScriptEngine* engine)
@@ -430,13 +430,13 @@ static void RegisterVariant(asIScriptEngine* engine)
     engine->RegisterObjectMethod("VariantMap", "const Variant& opIndex(const String&in) const", asFUNCTION(VariantMapAt), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("VariantMap", "const Variant& opIndex(const String&in) const", asFUNCTION(VariantMapAt), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("VariantMap", "bool Contains(const String&in) const", asFUNCTION(VariantMapContains), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("VariantMap", "bool Contains(const String&in) const", asFUNCTION(VariantMapContains), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("VariantMap", "void Erase(const String&in)", asFUNCTION(VariantMapErase), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("VariantMap", "void Erase(const String&in)", asFUNCTION(VariantMapErase), asCALL_CDECL_OBJLAST);
-    engine->RegisterObjectMethod("VariantMap", "void Clear()", asMETHOD(VariantMap, clear), asCALL_THISCALL);
-    engine->RegisterObjectMethod("VariantMap", "uint get_length() const", asMETHOD(VariantMap, size), asCALL_THISCALL);
+    engine->RegisterObjectMethod("VariantMap", "void Clear()", asMETHOD(VariantMap, Clear), asCALL_THISCALL);
+    engine->RegisterObjectMethod("VariantMap", "uint get_length() const", asMETHOD(VariantMap, Size), asCALL_THISCALL);
 }
 }
 
 
 static CScriptArray* StringSplit(char separator, const String* str)
 static CScriptArray* StringSplit(char separator, const String* str)
 {
 {
-    std::vector<String> result = Split(*str, separator);
+    Vector<String> result = Split(*str, separator);
     return VectorToArray<String>(result, "Array<String>");
     return VectorToArray<String>(result, "Array<String>");
 }
 }
 
 
@@ -523,11 +523,11 @@ static void DestructAttributeInfo(AttributeInfo* ptr)
 
 
 static CScriptArray* AttributeInfoGetEnumNames(AttributeInfo* ptr)
 static CScriptArray* AttributeInfoGetEnumNames(AttributeInfo* ptr)
 {
 {
-    std::vector<String> enumNames;
+    Vector<String> enumNames;
     const String* enumNamePtrs = ptr->enumNames_;
     const String* enumNamePtrs = ptr->enumNames_;
     while ((enumNamePtrs) && (enumNamePtrs->Length()))
     while ((enumNamePtrs) && (enumNamePtrs->Length()))
     {
     {
-        enumNames.push_back(*enumNamePtrs);
+        enumNames.Push(*enumNamePtrs);
         ++enumNamePtrs;
         ++enumNamePtrs;
     }
     }
     return VectorToArray<String>(enumNames, "Array<String>");
     return VectorToArray<String>(enumNames, "Array<String>");

+ 8 - 8
Engine/Engine/Engine.cpp

@@ -68,7 +68,7 @@ Engine::~Engine()
 {
 {
 }
 }
 
 
-bool Engine::Initialize(const String& windowTitle, const String& logName, const std::vector<String>& arguments)
+bool Engine::Initialize(const String& windowTitle, const String& logName, const Vector<String>& arguments)
 {
 {
     if (initialized_)
     if (initialized_)
         return true;
         return true;
@@ -88,7 +88,7 @@ bool Engine::Initialize(const String& windowTitle, const String& logName, const
     bool sixteenBit = true;
     bool sixteenBit = true;
     bool interpolate = true;
     bool interpolate = true;
     
     
-    for (unsigned i = 0; i < arguments.size(); ++i)
+    for (unsigned i = 0; i < arguments.Size(); ++i)
     {
     {
         if ((arguments[i][0] == '-') && (arguments[i].Length() >= 2))
         if ((arguments[i][0] == '-') && (arguments[i].Length() >= 2))
         {
         {
@@ -323,18 +323,18 @@ void Engine::DumpProfilingData()
 void Engine::DumpResources()
 void Engine::DumpResources()
 {
 {
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     ResourceCache* cache = GetSubsystem<ResourceCache>();
-    const std::map<ShortStringHash, ResourceGroup>& resourceGroups = cache->GetAllResources();
+    const Map<ShortStringHash, ResourceGroup>& resourceGroups = cache->GetAllResources();
     LOGRAW("\n");
     LOGRAW("\n");
     
     
-    for (std::map<ShortStringHash, ResourceGroup>::const_iterator i = resourceGroups.begin();
-        i != resourceGroups.end(); ++i)
+    for (Map<ShortStringHash, ResourceGroup>::ConstIterator i = resourceGroups.Begin();
+        i != resourceGroups.End(); ++i)
     {
     {
-        unsigned num = i->second.resources_.size();
-        unsigned memoryUse = i->second.memoryUse_;
+        unsigned num = i->second_.resources_.Size();
+        unsigned memoryUse = i->second_.memoryUse_;
         
         
         if (num)
         if (num)
         {
         {
-            LOGRAW("Resource type " + i->second.resources_.begin()->second->GetTypeName() +
+            LOGRAW("Resource type " + i->second_.resources_.Begin()->second_->GetTypeName() +
                 ": count " + ToString(num) + " memory use " + ToString(memoryUse) + "\n");
                 ": count " + ToString(num) + " memory use " + ToString(memoryUse) + "\n");
         }
         }
     }
     }

+ 2 - 2
Engine/Engine/Engine.h

@@ -41,8 +41,8 @@ public:
     virtual ~Engine();
     virtual ~Engine();
     
     
     /// Initialize and show the application window. Return true if successful
     /// Initialize and show the application window. Return true if successful
-    bool Initialize(const String& windowTitle = "Urho3D", const String& logName = "Urho3D.log", const std::vector<String>&
-        arguments = std::vector<String>());
+    bool Initialize(const String& windowTitle = "Urho3D", const String& logName = "Urho3D.log", const Vector<String>&
+        arguments = Vector<String>());
     /// Initialize script subsystem and register the script API. Return true if successful (engine must be initialized first)
     /// Initialize script subsystem and register the script API. Return true if successful (engine must be initialized first)
     bool InitializeScripting();
     bool InitializeScripting();
     /// Run one frame
     /// Run one frame

+ 13 - 13
Engine/Engine/GraphicsAPI.cpp

@@ -241,22 +241,22 @@ static void RegisterTextures(asIScriptEngine* engine)
 
 
 static Vector4 MaterialGetVertexShaderParameter(VSParameter parameter, Material* ptr)
 static Vector4 MaterialGetVertexShaderParameter(VSParameter parameter, Material* ptr)
 {
 {
-    const std::map<VSParameter, Vector4>& parameters = ptr->GetVertexShaderParameters();
-    std::map<VSParameter, Vector4>::const_iterator i = parameters.find(parameter);
-    if (i == parameters.end())
+    const Map<VSParameter, Vector4>& parameters = ptr->GetVertexShaderParameters();
+    Map<VSParameter, Vector4>::ConstIterator i = parameters.Find(parameter);
+    if (i == parameters.End())
         return Vector4::ZERO;
         return Vector4::ZERO;
     else
     else
-        return i->second;
+        return i->second_;
 }
 }
 
 
 static Vector4 MaterialGetPixelShaderParameter(PSParameter parameter, Material* ptr)
 static Vector4 MaterialGetPixelShaderParameter(PSParameter parameter, Material* ptr)
 {
 {
-    const std::map<PSParameter, Vector4>& parameters = ptr->GetPixelShaderParameters();
-    std::map<PSParameter, Vector4>::const_iterator i = parameters.find(parameter);
-    if (i == parameters.end())
+    const Map<PSParameter, Vector4>& parameters = ptr->GetPixelShaderParameters();
+    Map<PSParameter, Vector4>::ConstIterator i = parameters.Find(parameter);
+    if (i == parameters.End())
         return Vector4::ZERO;
         return Vector4::ZERO;
     else
     else
-        return i->second;
+        return i->second_;
 }
 }
 
 
 static Material* MaterialClone(const String& cloneName, Material* ptr)
 static Material* MaterialClone(const String& cloneName, Material* ptr)
@@ -859,7 +859,7 @@ static Node* RayQueryResultGetNode(RayQueryResult* ptr)
 
 
 static CScriptArray* OctreeRaycast(const Ray& ray, unsigned char drawableFlags, float maxDistance, RayQueryLevel level, Octree* ptr)
 static CScriptArray* OctreeRaycast(const Ray& ray, unsigned char drawableFlags, float maxDistance, RayQueryLevel level, Octree* ptr)
 {
 {
-    std::vector<RayQueryResult> result;
+    Vector<RayQueryResult> result;
     RayOctreeQuery query(result, ray, drawableFlags, false, false, maxDistance, level);
     RayOctreeQuery query(result, ray, drawableFlags, false, false, maxDistance, level);
     ptr->GetDrawables(query);
     ptr->GetDrawables(query);
     return VectorToArray<RayQueryResult>(result, "Array<RayQueryResult>");
     return VectorToArray<RayQueryResult>(result, "Array<RayQueryResult>");
@@ -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)
 {
 {
-    std::vector<Drawable*> result;
+    Vector<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)
 {
 {
-    std::vector<Drawable*> result;
+    Vector<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)
 {
 {
-    std::vector<Drawable*> result;
+    Vector<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)
 {
 {
-    std::vector<Drawable*> result;
+    Vector<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/IOAPI.cpp

@@ -187,7 +187,7 @@ static FileSystem* GetFileSystem()
 
 
 static CScriptArray* FileSystemScanDir(const String& pathName, const String& filter, unsigned flags, bool recursive, FileSystem* ptr)
 static CScriptArray* FileSystemScanDir(const String& pathName, const String& filter, unsigned flags, bool recursive, FileSystem* ptr)
 {
 {
-    std::vector<String> result;
+    Vector<String> result;
     ptr->ScanDir(result, pathName, filter, flags, recursive);
     ptr->ScanDir(result, pathName, filter, flags, recursive);
     return VectorToArray<String>(result, "Array<String>");
     return VectorToArray<String>(result, "Array<String>");
 }
 }
@@ -198,7 +198,7 @@ static int FileSystemSystemRun(const String& fileName, CScriptArray* srcArgument
         return -1;
         return -1;
     
     
     unsigned numArguments = srcArguments->GetSize();
     unsigned numArguments = srcArguments->GetSize();
-    std::vector<String> destArguments(numArguments);
+    Vector<String> destArguments(numArguments);
     for (unsigned i = 0; i < numArguments; ++i)
     for (unsigned i = 0; i < numArguments; ++i)
         destArguments[i] = *(static_cast<String*>(srcArguments->At(i)));
         destArguments[i] = *(static_cast<String*>(srcArguments->At(i)));
     
     

+ 1 - 1
Engine/Engine/PhysicsAPI.cpp

@@ -55,7 +55,7 @@ static Node* PhysicsRaycastResultGetNode(PhysicsRaycastResult* ptr)
 
 
 static CScriptArray* PhysicsWorldRaycast(const Ray& ray, float maxDistance, unsigned collisionMask, PhysicsWorld* ptr)
 static CScriptArray* PhysicsWorldRaycast(const Ray& ray, float maxDistance, unsigned collisionMask, PhysicsWorld* ptr)
 {
 {
-    static std::vector<PhysicsRaycastResult> result;
+    static Vector<PhysicsRaycastResult> result;
     ptr->Raycast(result, ray, maxDistance, collisionMask);
     ptr->Raycast(result, ray, maxDistance, collisionMask);
     return VectorToArray<PhysicsRaycastResult>(result, "Array<PhysicsRaycastResult>");
     return VectorToArray<PhysicsRaycastResult>(result, "Array<PhysicsRaycastResult>");
 }
 }

+ 2 - 2
Engine/Engine/Precompiled.h

@@ -25,5 +25,5 @@
 
 
 #include "StringBase.h"
 #include "StringBase.h"
 
 
-#include <map>
-#include <vector>
+#include "Map.h"
+#include "Vector.h"

+ 9 - 9
Engine/Engine/ScriptAPI.cpp

@@ -49,8 +49,8 @@ static asIScriptObject* NodeCreateScriptObjectWithFile(ScriptFile* file, const S
         return 0;
         return 0;
     
     
     // Try first to reuse an existing, empty ScriptInstance
     // Try first to reuse an existing, empty ScriptInstance
-    const std::vector<SharedPtr<Component> >& components = ptr->GetComponents();
-    for (std::vector<SharedPtr<Component> >::const_iterator i = components.begin(); i != components.end(); ++i)
+    const Vector<SharedPtr<Component> >& components = ptr->GetComponents();
+    for (Vector<SharedPtr<Component> >::ConstIterator i = components.Begin(); i != components.End(); ++i)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
@@ -86,8 +86,8 @@ static asIScriptObject* NodeCreateScriptObject(const String& scriptFileName, con
 asIScriptObject* NodeGetScriptObject(Node* ptr)
 asIScriptObject* NodeGetScriptObject(Node* ptr)
 {
 {
     // Get the first available ScriptInstance with an object
     // Get the first available ScriptInstance with an object
-    const std::vector<SharedPtr<Component> >& components = ptr->GetComponents();
-    for (std::vector<SharedPtr<Component> >::const_iterator i = components.begin(); i != components.end(); ++i)
+    const Vector<SharedPtr<Component> >& components = ptr->GetComponents();
+    for (Vector<SharedPtr<Component> >::ConstIterator i = components.Begin(); i != components.End(); ++i)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
@@ -103,8 +103,8 @@ asIScriptObject* NodeGetScriptObject(Node* ptr)
 
 
 asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
 asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
 {
 {
-    const std::vector<SharedPtr<Component> >& components = ptr->GetComponents();
-    for (std::vector<SharedPtr<Component> >::const_iterator i = components.begin(); i != components.end(); ++i)
+    const Vector<SharedPtr<Component> >& components = ptr->GetComponents();
+    for (Vector<SharedPtr<Component> >::ConstIterator i = components.Begin(); i != components.End(); ++i)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
@@ -128,7 +128,7 @@ static bool ScriptInstanceExecute(const String& declaration, CScriptArray* srcPa
     
     
     unsigned numParams = srcParams->GetSize();
     unsigned numParams = srcParams->GetSize();
     VariantVector destParams;
     VariantVector destParams;
-    destParams.resize(numParams);
+    destParams.Resize(numParams);
     
     
     for (unsigned i = 0; i < numParams; ++i)
     for (unsigned i = 0; i < numParams; ++i)
         destParams[i] = *(static_cast<Variant*>(srcParams->At(i)));
         destParams[i] = *(static_cast<Variant*>(srcParams->At(i)));
@@ -148,7 +148,7 @@ static void ScriptInstanceDelayedExecute(float delay, const String& declaration,
     
     
     unsigned numParams = srcParams->GetSize();
     unsigned numParams = srcParams->GetSize();
     VariantVector destParams;
     VariantVector destParams;
-    destParams.resize(numParams);
+    destParams.Resize(numParams);
     
     
     for (unsigned i = 0; i < numParams; ++i)
     for (unsigned i = 0; i < numParams; ++i)
         destParams[i] = *(static_cast<Variant*>(srcParams->At(i)));
         destParams[i] = *(static_cast<Variant*>(srcParams->At(i)));
@@ -215,7 +215,7 @@ static void SelfDelayedExecute(float delay, const String& declaration, CScriptAr
     
     
     unsigned numParams = srcParams->GetSize();
     unsigned numParams = srcParams->GetSize();
     VariantVector destParams;
     VariantVector destParams;
-    destParams.resize(numParams);
+    destParams.Resize(numParams);
     
     
     for (unsigned i = 0; i < numParams; ++i)
     for (unsigned i = 0; i < numParams; ++i)
         destParams[i] = *(static_cast<Variant*>(srcParams->At(i)));
         destParams[i] = *(static_cast<Variant*>(srcParams->At(i)));

+ 6 - 6
Engine/Engine/UIAPI.cpp

@@ -178,10 +178,10 @@ static void RegisterScrollView(asIScriptEngine* engine)
 void ListViewSetSelections(CScriptArray* selections, ListView* ptr)
 void ListViewSetSelections(CScriptArray* selections, ListView* ptr)
 {
 {
     unsigned numItems = selections->GetSize();
     unsigned numItems = selections->GetSize();
-    std::set<unsigned> dest;
+    Set<unsigned> dest;
     
     
     for (unsigned i = 0; i < numItems; ++i)
     for (unsigned i = 0; i < numItems; ++i)
-        dest.insert(*((unsigned*)selections->At(i)));
+        dest.Insert(*((unsigned*)selections->At(i)));
     
     
     ptr->SetSelections(dest);
     ptr->SetSelections(dest);
 }
 }
@@ -193,13 +193,13 @@ static CScriptArray* ListViewGetSelections(ListView* ptr)
 
 
 static CScriptArray* ListViewGetItems(ListView* ptr)
 static CScriptArray* ListViewGetItems(ListView* ptr)
 {
 {
-    std::vector<UIElement*> result = ptr->GetItems();
+    Vector<UIElement*> result = ptr->GetItems();
     return VectorToHandleArray<UIElement>(result, "Array<UIElement@>");
     return VectorToHandleArray<UIElement>(result, "Array<UIElement@>");
 }
 }
 
 
 static CScriptArray* ListViewGetSelectedItems(ListView* ptr)
 static CScriptArray* ListViewGetSelectedItems(ListView* ptr)
 {
 {
-    std::vector<UIElement*> result = ptr->GetSelectedItems();
+    Vector<UIElement*> result = ptr->GetSelectedItems();
     return VectorToHandleArray<UIElement>(result, "Array<UIElement@>");
     return VectorToHandleArray<UIElement>(result, "Array<UIElement@>");
 }
 }
 
 
@@ -325,7 +325,7 @@ static void RegisterMenu(asIScriptEngine* engine)
 
 
 static CScriptArray* DropDownListGetItems(DropDownList* ptr)
 static CScriptArray* DropDownListGetItems(DropDownList* ptr)
 {
 {
-    std::vector<UIElement*> result = ptr->GetItems();
+    Vector<UIElement*> result = ptr->GetItems();
     return VectorToHandleArray<UIElement>(result, "Array<UIElement@>");
     return VectorToHandleArray<UIElement>(result, "Array<UIElement@>");
 }
 }
 
 
@@ -372,7 +372,7 @@ static void FileSelectorSetFilters(CScriptArray* filters, unsigned defaultIndex,
         return;
         return;
     
     
     unsigned numFilters = filters->GetSize();
     unsigned numFilters = filters->GetSize();
-    std::vector<String> destFilters(numFilters);
+    Vector<String> destFilters(numFilters);
     
     
     for (unsigned i = 0; i < numFilters; ++i)
     for (unsigned i = 0; i < numFilters; ++i)
         destFilters[i] = *(static_cast<String*>(filters->At(i)));
         destFilters[i] = *(static_cast<String*>(filters->At(i)));

+ 102 - 103
Engine/Graphics/AnimatedModel.cpp

@@ -41,16 +41,15 @@
 #include "ResourceCache.h"
 #include "ResourceCache.h"
 #include "ResourceEvents.h"
 #include "ResourceEvents.h"
 #include "Scene.h"
 #include "Scene.h"
+#include "Sort.h"
 #include "VectorBuffer.h"
 #include "VectorBuffer.h"
 #include "VertexBuffer.h"
 #include "VertexBuffer.h"
 
 
-#include <algorithm>
-
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
 static const Vector3 dotScale(1 / 3.0f, 1 / 3.0f, 1 / 3.0f);
 static const Vector3 dotScale(1 / 3.0f, 1 / 3.0f, 1 / 3.0f);
 
 
-static bool CompareAnimationOrder(SharedPtr<AnimationState> lhs, SharedPtr<AnimationState> rhs)
+static bool CompareAnimationOrder(const SharedPtr<AnimationState>& lhs, const SharedPtr<AnimationState>& rhs)
 {
 {
     return lhs->GetLayer() < rhs->GetLayer();
     return lhs->GetLayer() < rhs->GetLayer();
 }
 }
@@ -85,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_, std::vector<unsigned char>());
-    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Animation States", animationStates_, std::vector<unsigned char>());
+    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Bone Animation Enabled", skeleton_, Vector<unsigned char>());
+    ATTRIBUTE(AnimatedModel, VAR_BUFFER, "Animation States", animationStates_, Vector<unsigned char>());
 }
 }
 
 
 void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
@@ -103,7 +102,7 @@ void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& val
     case offsetof(AnimatedModel, materials_):
     case offsetof(AnimatedModel, materials_):
         {
         {
             const ResourceRefList& refs = value.GetResourceRefList();
             const ResourceRefList& refs = value.GetResourceRefList();
-            for (unsigned i = 0; i < refs.ids_.size(); ++i)
+            for (unsigned i = 0; i < refs.ids_.Size(); ++i)
                 SetMaterial(i, cache->GetResource<Material>(refs.ids_[i]));
                 SetMaterial(i, cache->GetResource<Material>(refs.ids_[i]));
         }
         }
         break;
         break;
@@ -111,9 +110,9 @@ void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& val
     case offsetof(AnimatedModel, skeleton_):
     case offsetof(AnimatedModel, skeleton_):
         {
         {
             MemoryBuffer buf(value.GetBuffer());
             MemoryBuffer buf(value.GetBuffer());
-            std::vector<Bone>& bones = skeleton_.GetModifiableBones();
+            Vector<Bone>& bones = skeleton_.GetModifiableBones();
             unsigned numBones = buf.ReadVLE();
             unsigned numBones = buf.ReadVLE();
-            for (unsigned i = 0; (i < numBones) && (i < bones.size()); ++i)
+            for (unsigned i = 0; (i < numBones) && (i < bones.Size()); ++i)
                 bones[i].animated_ = buf.ReadBool();
                 bones[i].animated_ = buf.ReadBool();
         }
         }
         break;
         break;
@@ -162,9 +161,9 @@ Variant AnimatedModel::OnGetAttribute(const AttributeInfo& attr)
     case offsetof(AnimatedModel, skeleton_):
     case offsetof(AnimatedModel, skeleton_):
         {
         {
             VectorBuffer buf;
             VectorBuffer buf;
-            const std::vector<Bone>& bones = skeleton_.GetBones();
-            buf.WriteVLE(bones.size());
-            for (std::vector<Bone>::const_iterator i = bones.begin(); i != bones.end(); ++i)
+            const Vector<Bone>& bones = skeleton_.GetBones();
+            buf.WriteVLE(bones.Size());
+            for (Vector<Bone>::ConstIterator i = bones.Begin(); i != bones.End(); ++i)
                 buf.WriteBool(i->animated_);
                 buf.WriteBool(i->animated_);
             return buf.GetBuffer();
             return buf.GetBuffer();
         }
         }
@@ -172,8 +171,8 @@ Variant AnimatedModel::OnGetAttribute(const AttributeInfo& attr)
     case offsetof(AnimatedModel, animationStates_):
     case offsetof(AnimatedModel, animationStates_):
         {
         {
             VectorBuffer buf;
             VectorBuffer buf;
-            buf.WriteVLE(animationStates_.size());
-            for (std::vector<SharedPtr<AnimationState> >::iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+            buf.WriteVLE(animationStates_.Size());
+            for (Vector<SharedPtr<AnimationState> >::Iterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
             {
             {
                 AnimationState* state = *i;
                 AnimationState* state = *i;
                 Bone* startBone = state->GetStartBone();
                 Bone* startBone = state->GetStartBone();
@@ -209,11 +208,11 @@ void AnimatedModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance
     
     
     PROFILE(RaycastAnimatedModel);
     PROFILE(RaycastAnimatedModel);
     
     
-    const std::vector<Bone>& bones = skeleton_.GetBones();
+    const Vector<Bone>& bones = skeleton_.GetBones();
     Sphere boneSphere;
     Sphere boneSphere;
     RayQueryLevel level = query.level_;
     RayQueryLevel level = query.level_;
     
     
-    for (unsigned i = 0; i < bones.size(); ++i)
+    for (unsigned i = 0; i < bones.Size(); ++i)
     {
     {
         const Bone& bone = bones[i];
         const Bone& bone = bones[i];
         if (!bone.node_)
         if (!bone.node_)
@@ -235,7 +234,7 @@ void AnimatedModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance
                     result.node_ = GetNode();
                     result.node_ = GetNode();
                     result.distance_ = distance;
                     result.distance_ = distance;
                     result.subObject_ = i;
                     result.subObject_ = i;
-                    query.result_.push_back(result);
+                    query.result_.Push(result);
                 }
                 }
                 else
                 else
                 {
                 {
@@ -250,7 +249,7 @@ void AnimatedModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance
                         result.node_ = GetNode();
                         result.node_ = GetNode();
                         result.distance_ = distance;
                         result.distance_ = distance;
                         result.subObject_ = i;
                         result.subObject_ = i;
-                        query.result_.push_back(result);
+                        query.result_.Push(result);
                     }
                     }
                 }
                 }
             }
             }
@@ -267,7 +266,7 @@ void AnimatedModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance
                 result.node_ = GetNode();
                 result.node_ = GetNode();
                 result.subObject_ = i;
                 result.subObject_ = i;
                 result.distance_ = distance;
                 result.distance_ = distance;
-                query.result_.push_back(result);
+                query.result_.Push(result);
             }
             }
         }
         }
     }
     }
@@ -325,7 +324,7 @@ void AnimatedModel::UpdateGeometry(const FrameInfo& frame)
     if (lodLevelsDirty_)
     if (lodLevelsDirty_)
         CalculateLodLevels();
         CalculateLodLevels();
     
     
-    if ((morphsDirty_) && (morphs_.size()))
+    if ((morphsDirty_) && (morphs_.Size()))
         UpdateMorphs();
         UpdateMorphs();
     
     
     if (skinningDirty_)
     if (skinningDirty_)
@@ -339,19 +338,19 @@ void AnimatedModel::GetBatch(const FrameInfo& frame, unsigned batchIndex, Batch&
     batch.worldTransform_ = &GetWorldTransform();
     batch.worldTransform_ = &GetWorldTransform();
     batch.material_ = materials_[batchIndex];
     batch.material_ = materials_[batchIndex];
     
     
-    if (skinMatrices_.size())
+    if (skinMatrices_.Size())
     {
     {
         // Check if model has per-geometry bone mappings
         // Check if model has per-geometry bone mappings
-        if ((geometrySkinMatrices_.size()) && (geometrySkinMatrices_[batchIndex].size()))
+        if ((geometrySkinMatrices_.Size()) && (geometrySkinMatrices_[batchIndex].Size()))
         {
         {
             batch.shaderData_ = geometrySkinMatrices_[batchIndex][0].GetData();
             batch.shaderData_ = geometrySkinMatrices_[batchIndex][0].GetData();
-            batch.shaderDataSize_ = geometrySkinMatrices_[batchIndex].size() * 12;
+            batch.shaderDataSize_ = geometrySkinMatrices_[batchIndex].Size() * 12;
         }
         }
         // If not, use the global skin matrices
         // If not, use the global skin matrices
         else
         else
         {
         {
             batch.shaderData_ = skinMatrices_[0].GetData();
             batch.shaderData_ = skinMatrices_[0].GetData();
-            batch.shaderDataSize_ = skinMatrices_.size() * 12;
+            batch.shaderDataSize_ = skinMatrices_.Size() * 12;
         }
         }
     }
     }
 }
 }
@@ -377,32 +376,32 @@ void AnimatedModel::SetModel(Model* model, bool createBones)
     
     
     // Copy the subgeometry & LOD level structure
     // Copy the subgeometry & LOD level structure
     SetNumGeometries(model->GetNumGeometries());
     SetNumGeometries(model->GetNumGeometries());
-    const std::vector<std::vector<SharedPtr<Geometry> > >& geometries = model->GetGeometries();
-    for (unsigned i = 0; i < geometries.size(); ++i)
+    const Vector<Vector<SharedPtr<Geometry> > >& geometries = model->GetGeometries();
+    for (unsigned i = 0; i < geometries.Size(); ++i)
         geometries_[i] = geometries[i];
         geometries_[i] = geometries[i];
     
     
     // Copy geometry bone mappings
     // Copy geometry bone mappings
-    const std::vector<std::vector<unsigned> >& geometryBoneMappings = model->GetGeometryBoneMappings();
-    geometryBoneMappings_.clear();
-    for (unsigned i = 0; i < geometryBoneMappings.size(); ++i)
-        geometryBoneMappings_.push_back(geometryBoneMappings[i]);
+    const Vector<Vector<unsigned> >& geometryBoneMappings = model->GetGeometryBoneMappings();
+    geometryBoneMappings_.Clear();
+    for (unsigned i = 0; i < geometryBoneMappings.Size(); ++i)
+        geometryBoneMappings_.Push(geometryBoneMappings[i]);
     
     
     // Copy morphs
     // Copy morphs
-    morphvertexBuffer_.clear();
-    morphs_.clear();
-    const std::vector<ModelMorph>& morphs = model->GetMorphs();
-    for (unsigned i = 0; i < morphs.size(); ++i)
+    morphvertexBuffer_.Clear();
+    morphs_.Clear();
+    const Vector<ModelMorph>& morphs = model->GetMorphs();
+    for (unsigned i = 0; i < morphs.Size(); ++i)
     {
     {
         ModelMorph newMorph;
         ModelMorph newMorph;
         newMorph.name_ = morphs[i].name_;
         newMorph.name_ = morphs[i].name_;
         newMorph.nameHash_ = morphs[i].nameHash_;
         newMorph.nameHash_ = morphs[i].nameHash_;
         newMorph.weight_ = 0.0f;
         newMorph.weight_ = 0.0f;
         newMorph.buffers_ = morphs[i].buffers_;
         newMorph.buffers_ = morphs[i].buffers_;
-        morphs_.push_back(newMorph);
+        morphs_.Push(newMorph);
     }
     }
     
     
     // If model has morphs, must clone all geometries & vertex buffers that refer to morphable vertex data
     // If model has morphs, must clone all geometries & vertex buffers that refer to morphable vertex data
-    if (morphs.size())
+    if (morphs.Size())
     {
     {
         cloneGeometries();
         cloneGeometries();
         MarkMorphsDirty();
         MarkMorphsDirty();
@@ -430,7 +429,7 @@ AnimationState* AnimatedModel::AddAnimationState(Animation* animation)
         return existing;
         return existing;
     
     
     SharedPtr<AnimationState> newState(new AnimationState(this, animation));
     SharedPtr<AnimationState> newState(new AnimationState(this, animation));
-    animationStates_.push_back(newState);
+    animationStates_.Push(newState);
     MarkAnimationOrderDirty();
     MarkAnimationOrderDirty();
     return newState;
     return newState;
 }
 }
@@ -448,14 +447,14 @@ void AnimatedModel::RemoveAnimationState(const String& animationName)
 
 
 void AnimatedModel::RemoveAnimationState(StringHash animationNameHash)
 void AnimatedModel::RemoveAnimationState(StringHash animationNameHash)
 {
 {
-    for (std::vector<SharedPtr<AnimationState> >::iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::Iterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
     {
     {
         AnimationState* state = *i;
         AnimationState* state = *i;
         Animation* animation = state->GetAnimation();
         Animation* animation = state->GetAnimation();
         // Check both the animation and the resource name
         // Check both the animation and the resource name
         if ((animation->GetNameHash() == animationNameHash) || (animation->GetAnimationNameHash() == animationNameHash))
         if ((animation->GetNameHash() == animationNameHash) || (animation->GetAnimationNameHash() == animationNameHash))
         {
         {
-            animationStates_.erase(i);
+            animationStates_.Erase(i);
             MarkAnimationDirty();
             MarkAnimationDirty();
         }
         }
     }
     }
@@ -463,11 +462,11 @@ void AnimatedModel::RemoveAnimationState(StringHash animationNameHash)
 
 
 void AnimatedModel::RemoveAnimationState(AnimationState* state)
 void AnimatedModel::RemoveAnimationState(AnimationState* state)
 {
 {
-    for (std::vector<SharedPtr<AnimationState> >::iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::Iterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
     {
     {
         if (*i == state)
         if (*i == state)
         {
         {
-            animationStates_.erase(i);
+            animationStates_.Erase(i);
             MarkAnimationDirty();
             MarkAnimationDirty();
             return;
             return;
         }
         }
@@ -476,7 +475,7 @@ void AnimatedModel::RemoveAnimationState(AnimationState* state)
 
 
 void AnimatedModel::RemoveAllAnimationStates()
 void AnimatedModel::RemoveAllAnimationStates()
 {
 {
-    animationStates_.clear();
+    animationStates_.Clear();
     MarkAnimationDirty();
     MarkAnimationDirty();
 }
 }
 
 
@@ -496,7 +495,7 @@ void AnimatedModel::SetInvisibleLodFactor(float factor)
 
 
 void AnimatedModel::SetMorphWeight(unsigned index, float weight)
 void AnimatedModel::SetMorphWeight(unsigned index, float weight)
 {
 {
-    if (index >= morphs_.size())
+    if (index >= morphs_.Size())
         return;
         return;
     
     
     weight = Clamp(weight, 0.0f, 1.0f);
     weight = Clamp(weight, 0.0f, 1.0f);
@@ -509,11 +508,11 @@ void AnimatedModel::SetMorphWeight(unsigned index, float weight)
         // For a master model, set the same morph weight on non-master models
         // For a master model, set the same morph weight on non-master models
         if (isMaster_)
         if (isMaster_)
         {
         {
-            std::vector<AnimatedModel*> models;
+            Vector<AnimatedModel*> models;
             GetComponents<AnimatedModel>(models);
             GetComponents<AnimatedModel>(models);
             
             
             // Indexing might not be the same, so use the name hash instead
             // Indexing might not be the same, so use the name hash instead
-            for (unsigned i = 1; i < models.size(); ++i)
+            for (unsigned i = 1; i < models.Size(); ++i)
                 models[i]->SetMorphWeight(morphs_[index].nameHash_, weight);
                 models[i]->SetMorphWeight(morphs_[index].nameHash_, weight);
         }
         }
     }
     }
@@ -521,7 +520,7 @@ void AnimatedModel::SetMorphWeight(unsigned index, float weight)
 
 
 void AnimatedModel::SetMorphWeight(const String& name, float weight)
 void AnimatedModel::SetMorphWeight(const String& name, float weight)
 {
 {
-    for (unsigned i = 0; i < morphs_.size(); ++i)
+    for (unsigned i = 0; i < morphs_.Size(); ++i)
     {
     {
         if (morphs_[i].name_ == name)
         if (morphs_[i].name_ == name)
         {
         {
@@ -533,7 +532,7 @@ void AnimatedModel::SetMorphWeight(const String& name, float weight)
 
 
 void AnimatedModel::SetMorphWeight(StringHash nameHash, float weight)
 void AnimatedModel::SetMorphWeight(StringHash nameHash, float weight)
 {
 {
-    for (unsigned i = 0; i < morphs_.size(); ++i)
+    for (unsigned i = 0; i < morphs_.Size(); ++i)
     {
     {
         if (morphs_[i].nameHash_ == nameHash)
         if (morphs_[i].nameHash_ == nameHash)
         {
         {
@@ -545,7 +544,7 @@ void AnimatedModel::SetMorphWeight(StringHash nameHash, float weight)
 
 
 void AnimatedModel::ResetMorphWeights()
 void AnimatedModel::ResetMorphWeights()
 {
 {
-    for (std::vector<ModelMorph>::iterator i = morphs_.begin(); i != morphs_.end(); ++i)
+    for (Vector<ModelMorph>::Iterator i = morphs_.Begin(); i != morphs_.End(); ++i)
         i->weight_ = 0.0f;
         i->weight_ = 0.0f;
     
     
     MarkMorphsDirty();
     MarkMorphsDirty();
@@ -553,23 +552,23 @@ void AnimatedModel::ResetMorphWeights()
     // For a master model, reset weights on non-master models
     // For a master model, reset weights on non-master models
     if (isMaster_)
     if (isMaster_)
     {
     {
-        std::vector<AnimatedModel*> models;
+        Vector<AnimatedModel*> models;
         GetComponents<AnimatedModel>(models);
         GetComponents<AnimatedModel>(models);
         
         
         // Indexing might not be the same, so use the name hash instead
         // Indexing might not be the same, so use the name hash instead
-        for (unsigned i = 1; i < models.size(); ++i)
+        for (unsigned i = 1; i < models.Size(); ++i)
             models[i]->ResetMorphWeights();
             models[i]->ResetMorphWeights();
     }
     }
 }
 }
 
 
 float AnimatedModel::GetMorphWeight(unsigned index) const
 float AnimatedModel::GetMorphWeight(unsigned index) const
 {
 {
-    return index < morphs_.size() ? morphs_[index].weight_ : 0.0f;
+    return index < morphs_.Size() ? morphs_[index].weight_ : 0.0f;
 }
 }
 
 
 float AnimatedModel::GetMorphWeight(const String& name) const
 float AnimatedModel::GetMorphWeight(const String& name) const
 {
 {
-    for (std::vector<ModelMorph>::const_iterator i = morphs_.begin(); i != morphs_.end(); ++i)
+    for (Vector<ModelMorph>::ConstIterator i = morphs_.Begin(); i != morphs_.End(); ++i)
     {
     {
         if (i->name_ == name)
         if (i->name_ == name)
             return i->weight_;
             return i->weight_;
@@ -580,7 +579,7 @@ float AnimatedModel::GetMorphWeight(const String& name) const
 
 
 float AnimatedModel::GetMorphWeight(StringHash nameHash) const
 float AnimatedModel::GetMorphWeight(StringHash nameHash) const
 {
 {
-    for (std::vector<ModelMorph>::const_iterator i = morphs_.begin(); i != morphs_.end(); ++i)
+    for (Vector<ModelMorph>::ConstIterator i = morphs_.Begin(); i != morphs_.End(); ++i)
     {
     {
         if (i->nameHash_ == nameHash)
         if (i->nameHash_ == nameHash)
             return i->weight_;
             return i->weight_;
@@ -591,7 +590,7 @@ float AnimatedModel::GetMorphWeight(StringHash nameHash) const
 
 
 AnimationState* AnimatedModel::GetAnimationState(Animation* animation) const
 AnimationState* AnimatedModel::GetAnimationState(Animation* animation) const
 {
 {
-    for (std::vector<SharedPtr<AnimationState> >::const_iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::ConstIterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
     {
     {
         if ((*i)->GetAnimation() == animation)
         if ((*i)->GetAnimation() == animation)
             return *i;
             return *i;
@@ -602,7 +601,7 @@ AnimationState* AnimatedModel::GetAnimationState(Animation* animation) const
 
 
 AnimationState* AnimatedModel::GetAnimationState(const String& animationName) const
 AnimationState* AnimatedModel::GetAnimationState(const String& animationName) const
 {
 {
-    for (std::vector<SharedPtr<AnimationState> >::const_iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::ConstIterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
     {
     {
         Animation* animation = (*i)->GetAnimation();
         Animation* animation = (*i)->GetAnimation();
         
         
@@ -616,7 +615,7 @@ AnimationState* AnimatedModel::GetAnimationState(const String& animationName) co
 
 
 AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) const
 AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) const
 {
 {
-    for (std::vector<SharedPtr<AnimationState> >::const_iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::ConstIterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
     {
     {
         Animation* animation = (*i)->GetAnimation();
         Animation* animation = (*i)->GetAnimation();
         
         
@@ -630,7 +629,7 @@ AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) c
 
 
 AnimationState* AnimatedModel::GetAnimationState(unsigned index) const
 AnimationState* AnimatedModel::GetAnimationState(unsigned index) const
 {
 {
-    return index < animationStates_.size() ? animationStates_[index].GetPtr() : 0;
+    return index < animationStates_.Size() ? animationStates_[index].GetPtr() : 0;
 }
 }
 
 
 void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
 void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
@@ -658,8 +657,8 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         // Create scene nodes for the bones, or get from the master model if not master
         // Create scene nodes for the bones, or get from the master model if not master
         if (createBones)
         if (createBones)
         {
         {
-            std::vector<Bone>& bones = skeleton_.GetModifiableBones();
-            for (std::vector<Bone>::iterator i = bones.begin(); i != bones.end(); ++i)
+            Vector<Bone>& bones = skeleton_.GetModifiableBones();
+            for (Vector<Bone>::Iterator i = bones.Begin(); i != bones.End(); ++i)
             {
             {
                 // Create bones as local, as they are never to be directly synchronized over the network
                 // Create bones as local, as they are never to be directly synchronized over the network
                 Node* boneNode = node_->CreateChild(i->name_, true);
                 Node* boneNode = node_->CreateChild(i->name_, true);
@@ -668,10 +667,10 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
                 i->node_ = boneNode;
                 i->node_ = boneNode;
             }
             }
             
             
-            for (unsigned i = 0; i < bones.size(); ++i)
+            for (unsigned i = 0; i < bones.Size(); ++i)
             {
             {
                 unsigned parentIndex = bones[i].parentIndex_;
                 unsigned parentIndex = bones[i].parentIndex_;
-                if ((parentIndex != i) && (parentIndex < bones.size()))
+                if ((parentIndex != i) && (parentIndex < bones.Size()))
                     bones[parentIndex].node_->AddChild(bones[i].node_);
                     bones[parentIndex].node_->AddChild(bones[i].node_);
             }
             }
         }
         }
@@ -683,8 +682,8 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         
         
         if (createBones)
         if (createBones)
         {
         {
-            std::vector<Bone>& bones = skeleton_.GetModifiableBones();
-            for (std::vector<Bone>::iterator i = bones.begin(); i != bones.end(); ++i)
+            Vector<Bone>& bones = skeleton_.GetModifiableBones();
+            for (Vector<Bone>::Iterator i = bones.Begin(); i != bones.End(); ++i)
             {
             {
                 Node* boneNode = node_->GetChild(i->name_, true);
                 Node* boneNode = node_->GetChild(i->name_, true);
                 if (boneNode)
                 if (boneNode)
@@ -695,7 +694,7 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
     }
     }
     
     
     // Reserve space for skinning matrices
     // Reserve space for skinning matrices
-    skinMatrices_.resize(skeleton_.GetNumBones());
+    skinMatrices_.Resize(skeleton_.GetNumBones());
     RefreshGeometryBoneMappings();
     RefreshGeometryBoneMappings();
 }
 }
 
 
@@ -728,8 +727,8 @@ void AnimatedModel::OnWorldBoundingBoxUpdate()
         // If has bones, update world bounding box based on them
         // If has bones, update world bounding box based on them
         worldBoundingBox_.defined_ = false;
         worldBoundingBox_.defined_ = false;
         
         
-        const std::vector<Bone>& bones = skeleton_.GetBones();
-        for (std::vector<Bone>::const_iterator i = bones.begin(); i != bones.end(); ++i)
+        const Vector<Bone>& bones = skeleton_.GetBones();
+        for (Vector<Bone>::ConstIterator i = bones.Begin(); i != bones.End(); ++i)
         {
         {
             Node* boneNode = i->node_;
             Node* boneNode = i->node_;
             if (!boneNode)
             if (!boneNode)
@@ -750,8 +749,8 @@ void AnimatedModel::AssignBoneNodes()
         return;
         return;
     
     
     // Find the bone nodes from the node hierarchy and add listeners
     // Find the bone nodes from the node hierarchy and add listeners
-    std::vector<Bone>& bones = skeleton_.GetModifiableBones();
-    for (std::vector<Bone>::iterator i = bones.begin(); i != bones.end(); ++i)
+    Vector<Bone>& bones = skeleton_.GetModifiableBones();
+    for (Vector<Bone>::Iterator i = bones.Begin(); i != bones.End(); ++i)
     {
     {
         Node* boneNode = node_->GetChild(i->name_, true);
         Node* boneNode = node_->GetChild(i->name_, true);
         if (boneNode)
         if (boneNode)
@@ -760,7 +759,7 @@ void AnimatedModel::AssignBoneNodes()
     }
     }
     
     
     // Re-assign the same start bone to get the proper bone node this time
     // Re-assign the same start bone to get the proper bone node this time
-    for (std::vector<SharedPtr<AnimationState> >::iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::Iterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
     {
     {
         AnimationState* state = *i;
         AnimationState* state = *i;
         state->SetStartBone(state->GetStartBone());
         state->SetStartBone(state->GetStartBone());
@@ -795,12 +794,12 @@ void AnimatedModel::MarkMorphsDirty()
 void AnimatedModel::cloneGeometries()
 void AnimatedModel::cloneGeometries()
 {
 {
     // Clone vertex buffers as necessary
     // Clone vertex buffers as necessary
-    const std::vector<SharedPtr<VertexBuffer> >& originalVertexBuffers = model_->GetVertexBuffers();
-    std::map<VertexBuffer*, SharedPtr<VertexBuffer> > clonedVertexBuffers;
+    const Vector<SharedPtr<VertexBuffer> >& originalVertexBuffers = model_->GetVertexBuffers();
+    Map<VertexBuffer*, SharedPtr<VertexBuffer> > clonedVertexBuffers;
     
     
-    morphvertexBuffer_.resize(originalVertexBuffers.size());
+    morphvertexBuffer_.Resize(originalVertexBuffers.Size());
     
     
-    for (unsigned i = 0; i < originalVertexBuffers.size(); ++i)
+    for (unsigned i = 0; i < originalVertexBuffers.Size(); ++i)
     {
     {
         VertexBuffer* original = originalVertexBuffers[i];
         VertexBuffer* original = originalVertexBuffers[i];
         if (original->HasMorphRange())
         if (original->HasMorphRange())
@@ -823,20 +822,20 @@ void AnimatedModel::cloneGeometries()
     }
     }
     
     
     // Geometries will always be cloned fully. They contain only references to buffer, so they are relatively light
     // Geometries will always be cloned fully. They contain only references to buffer, so they are relatively light
-    for (unsigned i = 0; i < geometries_.size(); ++i)
+    for (unsigned i = 0; i < geometries_.Size(); ++i)
     {
     {
-        for (unsigned j = 0; j < geometries_[i].size(); ++j)
+        for (unsigned j = 0; j < geometries_[i].Size(); ++j)
         {
         {
             SharedPtr<Geometry> original = geometries_[i][j];
             SharedPtr<Geometry> original = geometries_[i][j];
             
             
-            const std::vector<SharedPtr<VertexBuffer> >& originalBuffers = original->GetVertexBuffers();
+            const Vector<SharedPtr<VertexBuffer> >& originalBuffers = original->GetVertexBuffers();
             
             
             SharedPtr<Geometry> clone(new Geometry(context_));
             SharedPtr<Geometry> clone(new Geometry(context_));
-            clone->SetNumVertexBuffers(originalVertexBuffers.size());
-            for (unsigned k = 0; k < originalVertexBuffers.size(); ++k)
+            clone->SetNumVertexBuffers(originalVertexBuffers.Size());
+            for (unsigned k = 0; k < originalVertexBuffers.Size(); ++k)
             {
             {
                 VertexBuffer* originalBuffer = originalBuffers[k];
                 VertexBuffer* originalBuffer = originalBuffers[k];
-                if (clonedVertexBuffers.find(originalBuffer) != clonedVertexBuffers.end())
+                if (clonedVertexBuffers.Find(originalBuffer) != clonedVertexBuffers.End())
                     clone->SetVertexBuffer(k, clonedVertexBuffers[originalBuffer], original->GetVertexElementMask(k));
                     clone->SetVertexBuffer(k, clonedVertexBuffers[originalBuffer], original->GetVertexElementMask(k));
                 else
                 else
                     clone->SetVertexBuffer(k, originalBuffers[k], original->GetVertexElementMask(k));
                     clone->SetVertexBuffer(k, originalBuffers[k], original->GetVertexElementMask(k));
@@ -853,33 +852,33 @@ void AnimatedModel::cloneGeometries()
 
 
 void AnimatedModel::RefreshGeometryBoneMappings()
 void AnimatedModel::RefreshGeometryBoneMappings()
 {
 {
-    geometrySkinMatrices_.clear();
-    geometrySkinMatrixPtrs_.clear();
+    geometrySkinMatrices_.Clear();
+    geometrySkinMatrixPtrs_.Clear();
     
     
-    if (!geometryBoneMappings_.size())
+    if (!geometryBoneMappings_.Size())
         return;
         return;
     
     
     // Check if all mappings are empty, then we do not need to use mapped skinning
     // Check if all mappings are empty, then we do not need to use mapped skinning
     bool allEmpty = true;
     bool allEmpty = true;
-    for (unsigned i = 0; i < geometryBoneMappings_.size(); ++i)
-        if (geometryBoneMappings_[i].size())
+    for (unsigned i = 0; i < geometryBoneMappings_.Size(); ++i)
+        if (geometryBoneMappings_[i].Size())
             allEmpty = false;
             allEmpty = false;
     
     
     if (allEmpty)
     if (allEmpty)
         return;
         return;
     
     
     // Reserve space for per-geometry skinning matrices
     // Reserve space for per-geometry skinning matrices
-    geometrySkinMatrices_.resize(geometryBoneMappings_.size());
-    for (unsigned i = 0; i < geometryBoneMappings_.size(); ++i)
-        geometrySkinMatrices_[i].resize(geometryBoneMappings_[i].size());
+    geometrySkinMatrices_.Resize(geometryBoneMappings_.Size());
+    for (unsigned i = 0; i < geometryBoneMappings_.Size(); ++i)
+        geometrySkinMatrices_[i].Resize(geometryBoneMappings_[i].Size());
     
     
     // Build original-to-skinindex matrix pointer mapping for fast copying
     // Build original-to-skinindex matrix pointer mapping for fast copying
     // Note: at this point layout of geometrySkinMatrices_ cannot be modified or pointers become invalid
     // Note: at this point layout of geometrySkinMatrices_ cannot be modified or pointers become invalid
-    geometrySkinMatrixPtrs_.resize(skeleton_.GetNumBones());
-    for (unsigned i = 0; i < geometryBoneMappings_.size(); ++i)
+    geometrySkinMatrixPtrs_.Resize(skeleton_.GetNumBones());
+    for (unsigned i = 0; i < geometryBoneMappings_.Size(); ++i)
     {
     {
-        for (unsigned j = 0; j < geometryBoneMappings_[i].size(); ++j)
-            geometrySkinMatrixPtrs_[geometryBoneMappings_[i][j]].push_back(&geometrySkinMatrices_[i][j]);
+        for (unsigned j = 0; j < geometryBoneMappings_[i].Size(); ++j)
+            geometrySkinMatrixPtrs_[geometryBoneMappings_[i][j]].Push(&geometrySkinMatrices_[i][j]);
     }
     }
 }
 }
 
 
@@ -906,13 +905,13 @@ void AnimatedModel::UpdateAnimation(const FrameInfo& frame)
     // Make sure animations are in ascending priority order
     // Make sure animations are in ascending priority order
     if (animationOrderDirty_)
     if (animationOrderDirty_)
     {
     {
-        std::sort(animationStates_.begin(), animationStates_.end(), CompareAnimationOrder);
+        Sort(animationStates_.Begin(), animationStates_.End(), CompareAnimationOrder);
         animationOrderDirty_ = false;
         animationOrderDirty_ = false;
     }
     }
     
     
     // Reset skeleton, then apply all animations
     // Reset skeleton, then apply all animations
     skeleton_.Reset();
     skeleton_.Reset();
-    for (std::vector<SharedPtr<AnimationState> >::iterator i = animationStates_.begin(); i != animationStates_.end(); ++i)
+    for (Vector<SharedPtr<AnimationState> >::Iterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
         (*i)->Apply();
         (*i)->Apply();
     
     
     // Animation has changed the bounding box: mark node for octree reinsertion
     // Animation has changed the bounding box: mark node for octree reinsertion
@@ -925,14 +924,14 @@ void AnimatedModel::UpdateSkinning()
     PROFILE(UpdateSkinning);
     PROFILE(UpdateSkinning);
     
     
     // Note: the model's world transform will be baked in the skin matrices
     // Note: the model's world transform will be baked in the skin matrices
-    const std::vector<Bone>& bones = skeleton_.GetBones();
+    const Vector<Bone>& bones = skeleton_.GetBones();
     // Use model's world transform in case a bone is missing
     // Use model's world transform in case a bone is missing
     const Matrix4x3& worldTransform = node_->GetWorldTransform();
     const Matrix4x3& worldTransform = node_->GetWorldTransform();
     
     
     // Skinning with global matrices only
     // Skinning with global matrices only
-    if (!geometrySkinMatrices_.size())
+    if (!geometrySkinMatrices_.Size())
     {
     {
-        for (unsigned i = 0; i < bones.size(); ++i)
+        for (unsigned i = 0; i < bones.Size(); ++i)
         {
         {
             const Bone& bone = bones[i];
             const Bone& bone = bones[i];
             if (bone.node_)
             if (bone.node_)
@@ -944,7 +943,7 @@ void AnimatedModel::UpdateSkinning()
     // Skinning with per-geometry matrices
     // Skinning with per-geometry matrices
     else
     else
     {
     {
-        for (unsigned i = 0; i < bones.size(); ++i)
+        for (unsigned i = 0; i < bones.Size(); ++i)
         {
         {
             const Bone& bone = bones[i];
             const Bone& bone = bones[i];
             if (bone.node_)
             if (bone.node_)
@@ -953,7 +952,7 @@ void AnimatedModel::UpdateSkinning()
                 skinMatrices_[i] = worldTransform;
                 skinMatrices_[i] = worldTransform;
             
             
             // Copy the skin matrix to per-geometry matrices as needed
             // Copy the skin matrix to per-geometry matrices as needed
-            for (unsigned j = 0; j < geometrySkinMatrixPtrs_[i].size(); ++j)
+            for (unsigned j = 0; j < geometrySkinMatrixPtrs_[i].Size(); ++j)
                 *geometrySkinMatrixPtrs_[i][j] = skinMatrices_[i];
                 *geometrySkinMatrixPtrs_[i][j] = skinMatrices_[i];
         }
         }
     }
     }
@@ -963,12 +962,12 @@ void AnimatedModel::UpdateSkinning()
 
 
 void AnimatedModel::UpdateMorphs()
 void AnimatedModel::UpdateMorphs()
 {
 {
-    if (morphs_.size())
+    if (morphs_.Size())
     {
     {
         PROFILE(UpdateMorphs);
         PROFILE(UpdateMorphs);
         
         
         // Reset the morph data range from all morphable vertex buffers, then apply morphs
         // Reset the morph data range from all morphable vertex buffers, then apply morphs
-        for (unsigned i = 0; i < morphvertexBuffer_.size(); ++i)
+        for (unsigned i = 0; i < morphvertexBuffer_.Size(); ++i)
         {
         {
             VertexBuffer* buffer = morphvertexBuffer_[i];
             VertexBuffer* buffer = morphvertexBuffer_[i];
             if (buffer)
             if (buffer)
@@ -978,13 +977,13 @@ void AnimatedModel::UpdateMorphs()
                     continue;
                     continue;
                 buffer->ResetMorphRange(lockedMorphRange);
                 buffer->ResetMorphRange(lockedMorphRange);
                 
                 
-                for (unsigned j = 0; j < morphs_.size(); ++j)
+                for (unsigned j = 0; j < morphs_.Size(); ++j)
                 {
                 {
                     if (morphs_[j].weight_ > 0.0f)
                     if (morphs_[j].weight_ > 0.0f)
                     {
                     {
-                        std::map<unsigned, VertexBufferMorph>::iterator k = morphs_[j].buffers_.find(i);
-                        if (k != morphs_[j].buffers_.end())
-                            ApplyMorph(buffer, lockedMorphRange, k->second, morphs_[j].weight_);
+                        Map<unsigned, VertexBufferMorph>::Iterator k = morphs_[j].buffers_.Find(i);
+                        if (k != morphs_[j].buffers_.End())
+                            ApplyMorph(buffer, lockedMorphRange, k->second_, morphs_[j].weight_);
                     }
                     }
                 }
                 }
                 
                 

+ 13 - 13
Engine/Graphics/AnimatedModel.h

@@ -27,7 +27,7 @@
 #include "Skeleton.h"
 #include "Skeleton.h"
 #include "StaticModel.h"
 #include "StaticModel.h"
 
 
-#include <set>
+#include "Set.h"
 
 
 class Animation;
 class Animation;
 class AnimationState;
 class AnimationState;
@@ -97,9 +97,9 @@ public:
     /// Return skeleton
     /// Return skeleton
     Skeleton& GetSkeleton() { return skeleton_; }
     Skeleton& GetSkeleton() { return skeleton_; }
     /// Return all animation states
     /// Return all animation states
-    const std::vector<SharedPtr<AnimationState> >& GetAnimationStates() const { return animationStates_; }
+    const Vector<SharedPtr<AnimationState> >& GetAnimationStates() const { return animationStates_; }
     /// Return number of animation states
     /// Return number of animation states
-    unsigned GetNumAnimationStates() const { return animationStates_.size(); }
+    unsigned GetNumAnimationStates() const { return animationStates_.Size(); }
     /// Return animation state by animation pointer
     /// Return animation state by animation pointer
     AnimationState* GetAnimationState(Animation* animation) const;
     AnimationState* GetAnimationState(Animation* animation) const;
     /// Return animation state by animation name
     /// Return animation state by animation name
@@ -113,11 +113,11 @@ public:
     /// Return animation LOD distance factor when not visible
     /// Return animation LOD distance factor when not visible
     float GetInvisibleLodFactor() const { return invisibleLodFactor_; }
     float GetInvisibleLodFactor() const { return invisibleLodFactor_; }
     /// Return all vertex morphs
     /// Return all vertex morphs
-    const std::vector<ModelMorph>& GetMorphs() const { return morphs_; }
+    const Vector<ModelMorph>& GetMorphs() const { return morphs_; }
     /// Return all morph vertex buffers
     /// Return all morph vertex buffers
-    const std::vector<SharedPtr<VertexBuffer> >& GetMorphVertexBuffers() const { return morphvertexBuffer_; }
+    const Vector<SharedPtr<VertexBuffer> >& GetMorphVertexBuffers() const { return morphvertexBuffer_; }
     /// Return number of vertex morphs
     /// Return number of vertex morphs
-    unsigned GetNumMorphs() const { return morphs_.size(); }
+    unsigned GetNumMorphs() const { return morphs_.Size(); }
     /// Return vertex morph weight by index
     /// Return vertex morph weight by index
     float GetMorphWeight(unsigned index) const;
     float GetMorphWeight(unsigned index) const;
     /// Return vertex morph weight by name
     /// Return vertex morph weight by name
@@ -164,19 +164,19 @@ private:
     /// Skeleton
     /// Skeleton
     Skeleton skeleton_;
     Skeleton skeleton_;
     /// Morph vertex buffers
     /// Morph vertex buffers
-    std::vector<SharedPtr<VertexBuffer> > morphvertexBuffer_;
+    Vector<SharedPtr<VertexBuffer> > morphvertexBuffer_;
     /// Vertex morphs
     /// Vertex morphs
-    std::vector<ModelMorph> morphs_;
+    Vector<ModelMorph> morphs_;
     /// Animation states
     /// Animation states
-    std::vector<SharedPtr<AnimationState> > animationStates_;
+    Vector<SharedPtr<AnimationState> > animationStates_;
     /// Skinning matrices
     /// Skinning matrices
-    std::vector<Matrix4x3> skinMatrices_;
+    Vector<Matrix4x3> skinMatrices_;
     /// Mapping of subgeometry bone indices, used if more bones than skinning shader can manage
     /// Mapping of subgeometry bone indices, used if more bones than skinning shader can manage
-    std::vector<std::vector<unsigned> > geometryBoneMappings_;
+    Vector<Vector<unsigned> > geometryBoneMappings_;
     /// Subgeometry skinning matrices, used if more bones than skinning shader can manage
     /// Subgeometry skinning matrices, used if more bones than skinning shader can manage
-    std::vector<std::vector<Matrix4x3> > geometrySkinMatrices_;
+    Vector<Vector<Matrix4x3> > geometrySkinMatrices_;
     /// Subgeometry skinning matrix pointers, if more bones than skinning shader can manage
     /// Subgeometry skinning matrix pointers, if more bones than skinning shader can manage
-    std::vector<std::vector<Matrix4x3*> > geometrySkinMatrixPtrs_;
+    Vector<Vector<Matrix4x3*> > geometrySkinMatrixPtrs_;
     /// The frame number animation LOD distance was last Calculated on
     /// The frame number animation LOD distance was last Calculated on
     unsigned animationLodFrameNumber_;
     unsigned animationLodFrameNumber_;
     /// Animation LOD bias
     /// Animation LOD bias

+ 15 - 15
Engine/Graphics/Animation.cpp

@@ -36,15 +36,15 @@ void AnimationTrack::GetKeyFrameIndex(float time, unsigned& index) const
     if (time < 0.0f)
     if (time < 0.0f)
         time = 0.0f;
         time = 0.0f;
     
     
-    if (index >= keyFrames_.size())
-        index = keyFrames_.size() - 1;
+    if (index >= keyFrames_.Size())
+        index = keyFrames_.Size() - 1;
     
     
     // Check for being too far ahead
     // Check for being too far ahead
     while ((index) && (time < keyFrames_[index].time_))
     while ((index) && (time < keyFrames_[index].time_))
         index--;
         index--;
     
     
     // Check for being too far behind
     // Check for being too far behind
-    while ((index < keyFrames_.size() - 1) && (time >= keyFrames_[index + 1].time_))
+    while ((index < keyFrames_.Size() - 1) && (time >= keyFrames_[index + 1].time_))
         index++;
         index++;
 }
 }
 
 
@@ -81,10 +81,10 @@ bool Animation::Load(Deserializer& source)
     animationName_ = source.ReadString();
     animationName_ = source.ReadString();
     animationNameHash_ = StringHash(animationName_);
     animationNameHash_ = StringHash(animationName_);
     length_ = source.ReadFloat();
     length_ = source.ReadFloat();
-    tracks_.clear();
+    tracks_.Clear();
     
     
     unsigned tracks = source.ReadUInt();
     unsigned tracks = source.ReadUInt();
-    tracks_.resize(tracks);
+    tracks_.Resize(tracks);
     memoryUse += tracks * sizeof(AnimationTrack);
     memoryUse += tracks * sizeof(AnimationTrack);
     
     
     // Read tracks
     // Read tracks
@@ -96,7 +96,7 @@ bool Animation::Load(Deserializer& source)
         newTrack.channelMask_ = source.ReadUByte();
         newTrack.channelMask_ = source.ReadUByte();
         
         
         unsigned keyFrames = source.ReadUInt();
         unsigned keyFrames = source.ReadUInt();
-        newTrack.keyFrames_.resize(keyFrames);
+        newTrack.keyFrames_.Resize(keyFrames);
         memoryUse += keyFrames * sizeof(AnimationKeyFrame);
         memoryUse += keyFrames * sizeof(AnimationKeyFrame);
         
         
         // Read keyframes of the track
         // Read keyframes of the track
@@ -125,16 +125,16 @@ bool Animation::Save(Serializer& dest)
     dest.WriteFloat(length_);
     dest.WriteFloat(length_);
     
     
     // Write tracks
     // Write tracks
-    dest.WriteUInt(tracks_.size());
-    for (unsigned i = 0; i < tracks_.size(); ++i)
+    dest.WriteUInt(tracks_.Size());
+    for (unsigned i = 0; i < tracks_.Size(); ++i)
     {
     {
         const AnimationTrack& track = tracks_[i];
         const AnimationTrack& track = tracks_[i];
         dest.WriteString(track.name_);
         dest.WriteString(track.name_);
         dest.WriteUByte(track.channelMask_);
         dest.WriteUByte(track.channelMask_);
-        dest.WriteUInt(track.keyFrames_.size());
+        dest.WriteUInt(track.keyFrames_.Size());
         
         
         // Write keyframes of the track
         // Write keyframes of the track
-        for (unsigned j = 0; j < track.keyFrames_.size(); ++j)
+        for (unsigned j = 0; j < track.keyFrames_.Size(); ++j)
         {
         {
             const AnimationKeyFrame& keyFrame = track.keyFrames_[j];
             const AnimationKeyFrame& keyFrame = track.keyFrames_[j];
             dest.WriteFloat(keyFrame.time_);
             dest.WriteFloat(keyFrame.time_);
@@ -161,24 +161,24 @@ void Animation::SetLength(float length)
     length_ = Max(length, 0.0f);
     length_ = Max(length, 0.0f);
 }
 }
 
 
-void Animation::SetTracks(const std::vector<AnimationTrack>& tracks)
+void Animation::SetTracks(const Vector<AnimationTrack>& tracks)
 {
 {
     tracks_ = tracks;
     tracks_ = tracks;
 }
 }
 
 
 unsigned Animation::GetNumTracks() const
 unsigned Animation::GetNumTracks() const
 {
 {
-    return tracks_.size();
+    return tracks_.Size();
 }
 }
 
 
 const AnimationTrack* Animation::GetTrack(unsigned index) const
 const AnimationTrack* Animation::GetTrack(unsigned index) const
 {
 {
-    return index < tracks_.size() ? &tracks_[index] : 0;
+    return index < tracks_.Size() ? &tracks_[index] : 0;
 }
 }
 
 
 const AnimationTrack* Animation::GetTrack(const String& name) const
 const AnimationTrack* Animation::GetTrack(const String& name) const
 {
 {
-    for (std::vector<AnimationTrack>::const_iterator i = tracks_.begin(); i != tracks_.end(); ++i)
+    for (Vector<AnimationTrack>::ConstIterator i = tracks_.Begin(); i != tracks_.End(); ++i)
     {
     {
         if ((*i).name_ == name)
         if ((*i).name_ == name)
             return &(*i);
             return &(*i);
@@ -189,7 +189,7 @@ const AnimationTrack* Animation::GetTrack(const String& name) const
 
 
 const AnimationTrack* Animation::GetTrack(StringHash nameHash) const
 const AnimationTrack* Animation::GetTrack(StringHash nameHash) const
 {
 {
-    for (std::vector<AnimationTrack>::const_iterator i = tracks_.begin(); i != tracks_.end(); ++i)
+    for (Vector<AnimationTrack>::ConstIterator i = tracks_.Begin(); i != tracks_.End(); ++i)
     {
     {
         if ((*i).nameHash_ == nameHash)
         if ((*i).nameHash_ == nameHash)
             return &(*i);
             return &(*i);

+ 4 - 4
Engine/Graphics/Animation.h

@@ -54,7 +54,7 @@ struct AnimationTrack
     /// Bitmask of included data (position, rotation, scale)
     /// Bitmask of included data (position, rotation, scale)
     unsigned char channelMask_;
     unsigned char channelMask_;
     /// Keyframes
     /// Keyframes
-    std::vector<AnimationKeyFrame> keyFrames_;
+    Vector<AnimationKeyFrame> keyFrames_;
 };
 };
 
 
 static const unsigned char CHANNEL_POSITION = 0x1;
 static const unsigned char CHANNEL_POSITION = 0x1;
@@ -84,7 +84,7 @@ public:
     /// Set animation length
     /// Set animation length
     void SetLength(float length);
     void SetLength(float length);
     /// Set all animation tracks
     /// Set all animation tracks
-    void SetTracks(const std::vector<AnimationTrack>& tracks);
+    void SetTracks(const Vector<AnimationTrack>& tracks);
     
     
     /// Return animation name
     /// Return animation name
     const String& GetAnimationName() const { return animationName_; }
     const String& GetAnimationName() const { return animationName_; }
@@ -93,7 +93,7 @@ public:
     /// Return animation length
     /// Return animation length
     float GetLength() const { return length_; }
     float GetLength() const { return length_; }
     /// Return all animation tracks
     /// Return all animation tracks
-    const std::vector<AnimationTrack>& GetTracks() const { return tracks_; }
+    const Vector<AnimationTrack>& GetTracks() const { return tracks_; }
     /// Return number of animation tracks
     /// Return number of animation tracks
     unsigned GetNumTracks() const;
     unsigned GetNumTracks() const;
     /// Return animation track by index
     /// Return animation track by index
@@ -111,5 +111,5 @@ private:
     /// Animation length
     /// Animation length
     float length_;
     float length_;
     /// Animation tracks
     /// Animation tracks
-    std::vector<AnimationTrack> tracks_;
+    Vector<AnimationTrack> tracks_;
 };
 };

+ 16 - 16
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_, std::vector<unsigned char>());
+    ATTRIBUTE(AnimationController, VAR_BUFFER, "Animations", animations_, Vector<unsigned char>());
 }
 }
 
 
 
 
@@ -64,8 +64,8 @@ void AnimationController::OnSetAttribute(const AttributeInfo& attr, const Varian
     case offsetof(AnimationController, animations_):
     case offsetof(AnimationController, animations_):
         {
         {
             MemoryBuffer buf(value.GetBuffer());
             MemoryBuffer buf(value.GetBuffer());
-            animations_.resize(buf.ReadVLE());
-            for (std::vector<AnimationControl>::iterator i = animations_.begin(); i != animations_.end(); ++i)
+            animations_.Resize(buf.ReadVLE());
+            for (Vector<AnimationControl>::Iterator i = animations_.Begin(); i != animations_.End(); ++i)
             {
             {
                 i->hash_ = buf.ReadStringHash();
                 i->hash_ = buf.ReadStringHash();
                 i->speed_ = buf.ReadFloat();
                 i->speed_ = buf.ReadFloat();
@@ -89,8 +89,8 @@ Variant AnimationController::OnGetAttribute(const AttributeInfo& attr)
     case offsetof(AnimationController, animations_):
     case offsetof(AnimationController, animations_):
         {
         {
             VectorBuffer buf;
             VectorBuffer buf;
-            buf.WriteVLE(animations_.size());
-            for (std::vector<AnimationControl>::const_iterator i = animations_.begin(); i != animations_.end(); ++i)
+            buf.WriteVLE(animations_.Size());
+            for (Vector<AnimationControl>::ConstIterator i = animations_.Begin(); i != animations_.End(); ++i)
             {
             {
                 buf.WriteStringHash(i->hash_);
                 buf.WriteStringHash(i->hash_);
                 buf.WriteFloat(i->speed_);
                 buf.WriteFloat(i->speed_);
@@ -115,7 +115,7 @@ void AnimationController::Update(float timeStep)
     PROFILE(UpdateAnimationController);
     PROFILE(UpdateAnimationController);
     
     
     // Loop through animations
     // Loop through animations
-    for (std::vector<AnimationControl>::iterator i = animations_.begin(); i != animations_.end();)
+    for (Vector<AnimationControl>::Iterator i = animations_.Begin(); i != animations_.End();)
     {
     {
         bool remove = false;
         bool remove = false;
         AnimationState* state = model->GetAnimationState(i->hash_);
         AnimationState* state = model->GetAnimationState(i->hash_);
@@ -158,7 +158,7 @@ void AnimationController::Update(float timeStep)
         {
         {
             if (state)
             if (state)
                 model->RemoveAnimationState(state);
                 model->RemoveAnimationState(state);
-            i = animations_.erase(i);
+            i = animations_.Erase(i);
         }
         }
         else
         else
             ++i;
             ++i;
@@ -189,8 +189,8 @@ bool AnimationController::Play(const String& name, int layer, bool looped, float
         AnimationControl newControl;
         AnimationControl newControl;
         Animation* animation = state->GetAnimation();
         Animation* animation = state->GetAnimation();
         newControl.hash_ = animation->GetNameHash();
         newControl.hash_ = animation->GetNameHash();
-        animations_.push_back(newControl);
-        index = animations_.size() - 1;
+        animations_.Push(newControl);
+        index = animations_.Size() - 1;
     }
     }
     
     
     state->SetLayer(layer);
     state->SetLayer(layer);
@@ -225,7 +225,7 @@ bool AnimationController::Stop(const String& name, float fadeOutTime)
     if (fadeOutTime <= 0.0f)
     if (fadeOutTime <= 0.0f)
     {
     {
         if (index != M_MAX_UNSIGNED)
         if (index != M_MAX_UNSIGNED)
-            animations_.erase(animations_.begin() + index);
+            animations_.Erase(animations_.Begin() + index);
         if (state)
         if (state)
             model->RemoveAnimationState(state);
             model->RemoveAnimationState(state);
     }
     }
@@ -247,7 +247,7 @@ void AnimationController::StopLayer(int layer, float fadeOutTime)
     if (!model)
     if (!model)
         return;
         return;
     
     
-    for (std::vector<AnimationControl>::iterator i = animations_.begin(); i != animations_.end();)
+    for (Vector<AnimationControl>::Iterator i = animations_.Begin(); i != animations_.End();)
     {
     {
         AnimationState* state = model->GetAnimationState(i->hash_);
         AnimationState* state = model->GetAnimationState(i->hash_);
         bool remove = false;
         bool remove = false;
@@ -269,7 +269,7 @@ void AnimationController::StopLayer(int layer, float fadeOutTime)
         }
         }
         
         
         if (remove)
         if (remove)
-            i = animations_.erase(i);
+            i = animations_.Erase(i);
         else
         else
             ++i;
             ++i;
     }
     }
@@ -281,7 +281,7 @@ void AnimationController::StopAll(float fadeOutTime)
     if (!model)
     if (!model)
         return;
         return;
     
     
-    for (std::vector<AnimationControl>::iterator i = animations_.begin(); i != animations_.end();)
+    for (Vector<AnimationControl>::Iterator i = animations_.Begin(); i != animations_.End();)
     {
     {
         bool remove = false;
         bool remove = false;
         
         
@@ -299,7 +299,7 @@ void AnimationController::StopAll(float fadeOutTime)
         }
         }
     
     
         if (remove)
         if (remove)
-            i = animations_.erase(i);
+            i = animations_.Erase(i);
         else
         else
             ++i;
             ++i;
     }
     }
@@ -329,7 +329,7 @@ bool AnimationController::FadeOthers(const String& name, float targetWeight, flo
     AnimatedModel* model = GetComponent<AnimatedModel>();
     AnimatedModel* model = GetComponent<AnimatedModel>();
     int layer = state->GetLayer();
     int layer = state->GetLayer();
     
     
-    for (unsigned i = 0; i < animations_.size(); ++i)
+    for (unsigned i = 0; i < animations_.Size(); ++i)
     {
     {
         if (i != index)
         if (i != index)
         {
         {
@@ -567,7 +567,7 @@ void AnimationController::FindAnimation(const String& name, unsigned& index, Ani
     
     
     // Find the internal control structure
     // Find the internal control structure
     index = M_MAX_UNSIGNED;
     index = M_MAX_UNSIGNED;
-    for (unsigned i = 0; i < animations_.size(); ++i)
+    for (unsigned i = 0; i < animations_.Size(); ++i)
     {
     {
         if (animations_[i].hash_ == nameHash)
         if (animations_[i].hash_ == nameHash)
         {
         {

+ 1 - 1
Engine/Graphics/AnimationController.h

@@ -146,5 +146,5 @@ private:
     void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
     void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
     
     
     /// Controlled animations
     /// Controlled animations
-    std::vector<AnimationControl> animations_;
+    Vector<AnimationControl> animations_;
 };
 };

+ 18 - 18
Engine/Graphics/AnimationState.cpp

@@ -44,8 +44,8 @@ AnimationState::AnimationState(AnimatedModel* model, Animation* animation) :
     SetStartBone(0);
     SetStartBone(0);
     
     
     // Setup a cache for last keyframe of each track
     // Setup a cache for last keyframe of each track
-    lastKeyFrame_.resize(animation_->GetNumTracks());
-    for (unsigned i = 0; i < lastKeyFrame_.size(); ++i)
+    lastKeyFrame_.Resize(animation_->GetNumTracks());
+    for (unsigned i = 0; i < lastKeyFrame_.Size(); ++i)
         lastKeyFrame_[i] = 0;
         lastKeyFrame_[i] = 0;
 }
 }
 
 
@@ -59,7 +59,7 @@ void AnimationState::SetStartBone(Bone* startBone)
         return;
         return;
     
     
     Skeleton& skeleton = model_->GetSkeleton();
     Skeleton& skeleton = model_->GetSkeleton();
-    const std::vector<Bone>& bones = skeleton.GetBones();
+    const Vector<Bone>& bones = skeleton.GetBones();
     Bone* rootBone = skeleton.GetRootBone();
     Bone* rootBone = skeleton.GetRootBone();
     if (!rootBone)
     if (!rootBone)
         return;
         return;
@@ -67,13 +67,13 @@ void AnimationState::SetStartBone(Bone* startBone)
         startBone = rootBone;
         startBone = rootBone;
     startBone_ = startBone;
     startBone_ = startBone;
     
     
-    trackToBoneMap_.clear();
+    trackToBoneMap_.Clear();
     if (!startBone->node_)
     if (!startBone->node_)
         return;
         return;
     
     
-    const std::vector<AnimationTrack>& tracks = animation_->GetTracks();
+    const Vector<AnimationTrack>& tracks = animation_->GetTracks();
     
     
-    for (unsigned i = 0; i < tracks.size(); ++i)
+    for (unsigned i = 0; i < tracks.Size(); ++i)
     {
     {
         // Include those tracks that are either the startbone itself, or its children
         // Include those tracks that are either the startbone itself, or its children
         Bone* trackBone = 0;
         Bone* trackBone = 0;
@@ -181,21 +181,21 @@ void AnimationState::Apply()
     // Check first if full weight or blending
     // Check first if full weight or blending
     if (weight_ == 1.0f)
     if (weight_ == 1.0f)
     {
     {
-        for (std::map<unsigned, Bone*>::const_iterator i = trackToBoneMap_.begin(); i != trackToBoneMap_.end(); ++i)
+        for (Map<unsigned, Bone*>::ConstIterator i = trackToBoneMap_.Begin(); i != trackToBoneMap_.End(); ++i)
         {
         {
-            const AnimationTrack* track = animation_->GetTrack(i->first);
-            Bone* bone = i->second;
+            const AnimationTrack* track = animation_->GetTrack(i->first_);
+            Bone* bone = i->second_;
             Node* boneNode = bone->node_;
             Node* boneNode = bone->node_;
-            if ((!boneNode) || (!bone->animated_) || (!track->keyFrames_.size()))
+            if ((!boneNode) || (!bone->animated_) || (!track->keyFrames_.Size()))
                 continue;
                 continue;
             
             
-            unsigned& frame = lastKeyFrame_[i->first];
+            unsigned& frame = lastKeyFrame_[i->first_];
             track->GetKeyFrameIndex(time_, frame);
             track->GetKeyFrameIndex(time_, frame);
             
             
             // Check if next frame to interpolate to is valid, or if wrapping is needed (looping animation only)
             // Check if next frame to interpolate to is valid, or if wrapping is needed (looping animation only)
             unsigned nextFrame = frame + 1;
             unsigned nextFrame = frame + 1;
             bool interpolate = true;
             bool interpolate = true;
-            if (nextFrame >= track->keyFrames_.size())
+            if (nextFrame >= track->keyFrames_.Size())
             {
             {
                 if (!looped_)
                 if (!looped_)
                 {
                 {
@@ -244,21 +244,21 @@ void AnimationState::Apply()
     }
     }
     else
     else
     {
     {
-        for (std::map<unsigned, Bone*>::const_iterator i = trackToBoneMap_.begin(); i != trackToBoneMap_.end(); ++i)
+        for (Map<unsigned, Bone*>::ConstIterator i = trackToBoneMap_.Begin(); i != trackToBoneMap_.End(); ++i)
         {
         {
-            const AnimationTrack* track = animation_->GetTrack(i->first);
-            Bone* bone = i->second;
+            const AnimationTrack* track = animation_->GetTrack(i->first_);
+            Bone* bone = i->second_;
             Node* boneNode = bone->node_;
             Node* boneNode = bone->node_;
-            if ((!boneNode) || (!bone->animated_) || (!track->keyFrames_.size()))
+            if ((!boneNode) || (!bone->animated_) || (!track->keyFrames_.Size()))
                 continue;
                 continue;
             
             
-            unsigned& frame = lastKeyFrame_[i->first];
+            unsigned& frame = lastKeyFrame_[i->first_];
             track->GetKeyFrameIndex(time_, frame);
             track->GetKeyFrameIndex(time_, frame);
             
             
             // Check if next frame to interpolate to is valid, or if wrapping is needed (looping animation only)
             // Check if next frame to interpolate to is valid, or if wrapping is needed (looping animation only)
             unsigned nextFrame = frame + 1;
             unsigned nextFrame = frame + 1;
             bool interpolate = true;
             bool interpolate = true;
-            if (nextFrame >= track->keyFrames_.size())
+            if (nextFrame >= track->keyFrames_.Size())
             {
             {
                 if (!looped_)
                 if (!looped_)
                 {
                 {

+ 3 - 3
Engine/Graphics/AnimationState.h

@@ -25,7 +25,7 @@
 
 
 #include "SharedPtr.h"
 #include "SharedPtr.h"
 
 
-#include <map>
+#include "Map.h"
 
 
 class Animation;
 class Animation;
 class AnimatedModel;
 class AnimatedModel;
@@ -91,9 +91,9 @@ private:
     /// Start bone
     /// Start bone
     Bone* startBone_;
     Bone* startBone_;
     /// Mapping of animation track indices to bones
     /// Mapping of animation track indices to bones
-    std::map<unsigned, Bone*> trackToBoneMap_;
+    Map<unsigned, Bone*> trackToBoneMap_;
     /// Last keyframe on each animation track for optimized keyframe search
     /// Last keyframe on each animation track for optimized keyframe search
-    std::vector<unsigned> lastKeyFrame_;
+    Vector<unsigned> lastKeyFrame_;
     /// Looped flag
     /// Looped flag
     bool looped_;
     bool looped_;
     /// Blending weight
     /// Blending weight

+ 63 - 64
Engine/Graphics/Batch.cpp

@@ -31,16 +31,15 @@
 #include "Renderer.h"
 #include "Renderer.h"
 #include "PixelShader.h"
 #include "PixelShader.h"
 #include "Profiler.h"
 #include "Profiler.h"
+#include "Sort.h"
 #include "Technique.h"
 #include "Technique.h"
 #include "Texture2D.h"
 #include "Texture2D.h"
 #include "VertexBuffer.h"
 #include "VertexBuffer.h"
 #include "VertexShader.h"
 #include "VertexShader.h"
 
 
-#include <algorithm>
-
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
-bool CompareBatchesFrontToBack(const Batch* lhs, const Batch* rhs)
+inline bool CompareBatchesFrontToBack(Batch* lhs, Batch* rhs)
 {
 {
     if (lhs->sortKey_ == rhs->sortKey_)
     if (lhs->sortKey_ == rhs->sortKey_)
         return lhs->distance_ < rhs->distance_;
         return lhs->distance_ < rhs->distance_;
@@ -48,7 +47,7 @@ bool CompareBatchesFrontToBack(const Batch* lhs, const Batch* rhs)
         return lhs->sortKey_ < rhs->sortKey_;
         return lhs->sortKey_ < rhs->sortKey_;
 }
 }
 
 
-bool CompareBatchesBackToFront(const Batch* lhs, const Batch* rhs)
+inline bool CompareBatchesBackToFront(Batch* lhs, Batch* rhs)
 {
 {
     if (lhs->distance_ == rhs->distance_)
     if (lhs->distance_ == rhs->distance_)
         return lhs->sortKey_ < rhs->sortKey_;
         return lhs->sortKey_ < rhs->sortKey_;
@@ -56,7 +55,7 @@ bool CompareBatchesBackToFront(const Batch* lhs, const Batch* rhs)
         return lhs->distance_ > rhs->distance_;
         return lhs->distance_ > rhs->distance_;
 }
 }
 
 
-bool CompareInstancesFrontToBack(const InstanceData& lhs, const InstanceData& rhs)
+inline bool CompareInstancesFrontToBack(const InstanceData& lhs, const InstanceData& rhs)
 {
 {
     return lhs.distance_ < rhs.distance_;
     return lhs.distance_ < rhs.distance_;
 }
 }
@@ -91,7 +90,7 @@ void Batch::Prepare(Graphics* graphics, bool SetModelTransform) const
         graphics->SetDepthTest(pass_->GetDepthTestMode());
         graphics->SetDepthTest(pass_->GetDepthTestMode());
         graphics->SetDepthWrite(pass_->GetDepthWrite());
         graphics->SetDepthWrite(pass_->GetDepthWrite());
         
         
-        const std::vector<SharedPtr<Texture> >& textures = material_->GetTextures();
+        const Vector<SharedPtr<Texture> >& textures = material_->GetTextures();
         
         
         if (pixelShader_->HasTextureUnit(TU_DIFFUSE))
         if (pixelShader_->HasTextureUnit(TU_DIFFUSE))
             graphics->SetTexture(TU_DIFFUSE, textures[TU_DIFFUSE]);
             graphics->SetTexture(TU_DIFFUSE, textures[TU_DIFFUSE]);
@@ -201,11 +200,11 @@ void Batch::Prepare(Graphics* graphics, bool SetModelTransform) const
     // Set material's vertex shader parameters
     // Set material's vertex shader parameters
     if (material_)
     if (material_)
     {
     {
-        const std::map<VSParameter, Vector4>& parameters = material_->GetVertexShaderParameters();
-        for (std::map<VSParameter, Vector4>::const_iterator i = parameters.begin(); i != parameters.end(); ++i)
+        const Map<VSParameter, Vector4>& parameters = material_->GetVertexShaderParameters();
+        for (Map<VSParameter, Vector4>::ConstIterator i = parameters.Begin(); i != parameters.End(); ++i)
         {
         {
-            if (vertexShader_->NeedParameterUpdate(i->first, material_))
-                graphics->SetVertexShaderParameter(i->first, i->second);
+            if (vertexShader_->NeedParameterUpdate(i->first_, material_))
+                graphics->SetVertexShaderParameter(i->first_, i->second_);
         }
         }
     }
     }
     
     
@@ -280,11 +279,11 @@ void Batch::Prepare(Graphics* graphics, bool SetModelTransform) const
     // Set material's pixel shader parameters
     // Set material's pixel shader parameters
     if (material_)
     if (material_)
     {
     {
-        const std::map<PSParameter, Vector4>& parameters = material_->GetPixelShaderParameters();
-        for (std::map<PSParameter, Vector4>::const_iterator i = parameters.begin(); i != parameters.end(); ++i)
+        const Map<PSParameter, Vector4>& parameters = material_->GetPixelShaderParameters();
+        for (Map<PSParameter, Vector4>::ConstIterator i = parameters.Begin(); i != parameters.End(); ++i)
         {
         {
-            if (pixelShader_->NeedParameterUpdate(i->first, material_))
-                graphics->SetPixelShaderParameter(i->first, i->second);
+            if (pixelShader_->NeedParameterUpdate(i->first_, material_))
+                graphics->SetPixelShaderParameter(i->first_, i->second_);
         }
         }
     }
     }
     
     
@@ -359,22 +358,22 @@ void Batch::Draw(Graphics* graphics) const
 void BatchGroup::SetTransforms(void* lockedData, unsigned& freeIndex)
 void BatchGroup::SetTransforms(void* lockedData, unsigned& freeIndex)
 {
 {
     // Do not use up buffer space if not going to draw as instanced
     // Do not use up buffer space if not going to draw as instanced
-    if (instances_.size() < MIN_INSTANCES)
+    if (instances_.Size() < MIN_INSTANCES)
         return;
         return;
     
     
     startIndex_ = freeIndex;
     startIndex_ = freeIndex;
     Matrix4x3* dest = (Matrix4x3*)lockedData;
     Matrix4x3* dest = (Matrix4x3*)lockedData;
     dest += freeIndex;
     dest += freeIndex;
     
     
-    for (unsigned i = 0; i < instances_.size(); ++i)
+    for (unsigned i = 0; i < instances_.Size(); ++i)
         *dest++ = *instances_[i].worldTransform_;
         *dest++ = *instances_[i].worldTransform_;
     
     
-    freeIndex += instances_.size();
+    freeIndex += instances_.Size();
 }
 }
 
 
 void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
 void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
 {
 {
-    if (!instances_.size())
+    if (!instances_.Size())
         return;
         return;
     
     
     // Construct a temporary batch for rendering
     // Construct a temporary batch for rendering
@@ -389,14 +388,14 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
     batch.vertexShaderIndex_ = vertexShaderIndex_;
     batch.vertexShaderIndex_ = vertexShaderIndex_;
     
     
     // Draw as individual instances if below minimum size, or if instancing not supported
     // Draw as individual instances if below minimum size, or if instancing not supported
-    if ((instances_.size() < MIN_INSTANCES) || (!buffer))
+    if ((instances_.Size() < MIN_INSTANCES) || (!buffer))
     {
     {
         batch.Prepare(graphics, false);
         batch.Prepare(graphics, false);
         
         
         graphics->SetIndexBuffer(geometry_->GetIndexBuffer());
         graphics->SetIndexBuffer(geometry_->GetIndexBuffer());
         graphics->SetVertexBuffers(geometry_->GetVertexBuffers(), geometry_->GetVertexElementMasks());
         graphics->SetVertexBuffers(geometry_->GetVertexBuffers(), geometry_->GetVertexElementMasks());
         
         
-        for (unsigned i = 0; i < instances_.size(); ++i)
+        for (unsigned i = 0; i < instances_.Size(); ++i)
         {
         {
             if (vertexShader_->NeedParameterUpdate(VSP_MODEL, instances_[i].worldTransform_))
             if (vertexShader_->NeedParameterUpdate(VSP_MODEL, instances_[i].worldTransform_))
                 graphics->SetVertexShaderParameter(VSP_MODEL, *instances_[i].worldTransform_);
                 graphics->SetVertexShaderParameter(VSP_MODEL, *instances_[i].worldTransform_);
@@ -409,8 +408,8 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
     {
     {
         // Switch to the instancing vertex shader
         // Switch to the instancing vertex shader
         // The indexing is different in the forward lit passes
         // The indexing is different in the forward lit passes
-        std::vector<SharedPtr<VertexShader> >& vertexShaders = pass_->GetVertexShaders();
-        std::vector<SharedPtr<PixelShader> >& pixelShaders = pass_->GetPixelShaders();
+        Vector<SharedPtr<VertexShader> >& vertexShaders = pass_->GetVertexShaders();
+        Vector<SharedPtr<PixelShader> >& pixelShaders = pass_->GetPixelShaders();
         PassType type = pass_->GetType();
         PassType type = pass_->GetType();
         if ((type != PASS_LITBASE) && (type != PASS_LIGHT))
         if ((type != PASS_LITBASE) && (type != PASS_LIGHT))
             batch.vertexShader_ = vertexShaders[vertexShaderIndex_ + GEOM_INSTANCED];
             batch.vertexShader_ = vertexShaders[vertexShaderIndex_ + GEOM_INSTANCED];
@@ -420,18 +419,18 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
         batch.Prepare(graphics, false);
         batch.Prepare(graphics, false);
         
         
         // Get the geometry vertex buffers, then add the instancing stream buffer
         // Get the geometry vertex buffers, then add the instancing stream buffer
-        std::vector<SharedPtr<VertexBuffer> > vertexBuffers = geometry_->GetVertexBuffers();
-        std::vector<unsigned> elementMasks = geometry_->GetVertexElementMasks();
-        vertexBuffers.push_back(SharedPtr<VertexBuffer>(buffer));
-        elementMasks.push_back(buffer->GetElementMask());
+        Vector<SharedPtr<VertexBuffer> > vertexBuffers = geometry_->GetVertexBuffers();
+        Vector<unsigned> elementMasks = geometry_->GetVertexElementMasks();
+        vertexBuffers.Push(SharedPtr<VertexBuffer>(buffer));
+        elementMasks.Push(buffer->GetElementMask());
         
         
         // No stream offset support, instancing buffer not pre-filled with transforms: have to lock and fill now
         // No stream offset support, instancing buffer not pre-filled with transforms: have to lock and fill now
         if (startIndex_ == M_MAX_UNSIGNED)
         if (startIndex_ == M_MAX_UNSIGNED)
         {
         {
             unsigned startIndex = 0;
             unsigned startIndex = 0;
-            while (startIndex < instances_.size())
+            while (startIndex < instances_.Size())
             {
             {
-                unsigned instances = instances_.size() - startIndex;
+                unsigned instances = instances_.Size() - startIndex;
                 if (instances > buffer->GetVertexCount())
                 if (instances > buffer->GetVertexCount())
                     instances = buffer->GetVertexCount();
                     instances = buffer->GetVertexCount();
                 
                 
@@ -458,25 +457,25 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
             graphics->SetIndexBuffer(geometry_->GetIndexBuffer());
             graphics->SetIndexBuffer(geometry_->GetIndexBuffer());
             graphics->SetVertexBuffers(vertexBuffers, elementMasks, startIndex_);
             graphics->SetVertexBuffers(vertexBuffers, elementMasks, startIndex_);
             graphics->DrawInstanced(geometry_->GetPrimitiveType(), geometry_->GetIndexStart(), geometry_->GetIndexCount(),
             graphics->DrawInstanced(geometry_->GetPrimitiveType(), geometry_->GetIndexStart(), geometry_->GetIndexCount(),
-                geometry_->GetVertexStart(), geometry_->GetVertexCount(), instances_.size());
+                geometry_->GetVertexStart(), geometry_->GetVertexCount(), instances_.Size());
         }
         }
     }
     }
 }
 }
 
 
 void BatchQueue::Clear()
 void BatchQueue::Clear()
 {
 {
-    batches_.clear();
-    sortedPriorityBatches_.clear();
-    sortedBatches_.clear();
-    priorityBatchGroups_.clear();
-    batchGroups_.clear();
+    batches_.Clear();
+    sortedPriorityBatches_.Clear();
+    sortedBatches_.Clear();
+    priorityBatchGroups_.Clear();
+    batchGroups_.Clear();
 }
 }
 
 
 void BatchQueue::AddBatch(const Batch& batch, bool noInstancing)
 void BatchQueue::AddBatch(const Batch& batch, bool noInstancing)
 {
 {
     // If batch is something else than static, has custom view, or has per-instance shader data defined, can not instance
     // If batch is something else than static, has custom view, or has per-instance shader data defined, can not instance
     if ((noInstancing) || (batch.geometryType_ != GEOM_STATIC) || (batch.overrideView_) || (batch.shaderData_))
     if ((noInstancing) || (batch.geometryType_ != GEOM_STATIC) || (batch.overrideView_) || (batch.shaderData_))
-        batches_.push_back(batch);
+        batches_.Push(batch);
     else
     else
     {
     {
         BatchGroupKey key;
         BatchGroupKey key;
@@ -485,10 +484,10 @@ void BatchQueue::AddBatch(const Batch& batch, bool noInstancing)
         key.material_ = batch.material_;
         key.material_ = batch.material_;
         key.geometry_ = batch.geometry_;
         key.geometry_ = batch.geometry_;
         
         
-        std::map<BatchGroupKey, BatchGroup>* groups = batch.hasPriority_ ? &priorityBatchGroups_ : &batchGroups_;
+        Map<BatchGroupKey, BatchGroup>* groups = batch.hasPriority_ ? &priorityBatchGroups_ : &batchGroups_;
         
         
-        std::map<BatchGroupKey, BatchGroup>::iterator i = groups->find(key);
-        if (i == groups->end())
+        Map<BatchGroupKey, BatchGroup>::Iterator i = groups->Find(key);
+        if (i == groups->End())
         {
         {
             // Create new group
             // Create new group
             BatchGroup newGroup;
             BatchGroup newGroup;
@@ -500,56 +499,56 @@ void BatchQueue::AddBatch(const Batch& batch, bool noInstancing)
             newGroup.camera_ = batch.camera_;
             newGroup.camera_ = batch.camera_;
             newGroup.light_ = batch.light_;
             newGroup.light_ = batch.light_;
             newGroup.vertexShaderIndex_ = batch.vertexShaderIndex_;
             newGroup.vertexShaderIndex_ = batch.vertexShaderIndex_;
-            newGroup.instances_.push_back(InstanceData(batch.worldTransform_, batch.distance_));
-            groups->insert(std::make_pair(key, newGroup));
+            newGroup.instances_.Push(InstanceData(batch.worldTransform_, batch.distance_));
+            groups->Insert(MakePair(key, newGroup));
         }
         }
         else
         else
-            i->second.instances_.push_back(InstanceData(batch.worldTransform_, batch.distance_));
+            i->second_.instances_.Push(InstanceData(batch.worldTransform_, batch.distance_));
     }
     }
 }
 }
 
 
 void BatchQueue::SortBackToFront()
 void BatchQueue::SortBackToFront()
 {
 {
-    sortedPriorityBatches_.clear();
-    sortedBatches_.resize(batches_.size());
+    sortedPriorityBatches_.Clear();
+    sortedBatches_.Resize(batches_.Size());
     
     
-    for (unsigned i = 0; i < batches_.size(); ++i)
+    for (unsigned i = 0; i < batches_.Size(); ++i)
         sortedBatches_[i] = &batches_[i];
         sortedBatches_[i] = &batches_[i];
     
     
-    std::sort(sortedBatches_.begin(), sortedBatches_.end(), CompareBatchesBackToFront);
+    Sort(sortedBatches_.Begin(), sortedBatches_.End(), CompareBatchesBackToFront);
 }
 }
 
 
 void BatchQueue::SortFrontToBack()
 void BatchQueue::SortFrontToBack()
 {
 {
-    sortedPriorityBatches_.clear();
-    sortedBatches_.clear();
+    sortedPriorityBatches_.Clear();
+    sortedBatches_.Clear();
     
     
     // Must explicitly divide into priority batches and non-priority, so that priorities do not get mixed up between
     // Must explicitly divide into priority batches and non-priority, so that priorities do not get mixed up between
     // instanced and non-instanced batches
     // instanced and non-instanced batches
-    for (unsigned i = 0; i < batches_.size(); ++i)
+    for (unsigned i = 0; i < batches_.Size(); ++i)
     {
     {
         if (batches_[i].hasPriority_)
         if (batches_[i].hasPriority_)
-            sortedPriorityBatches_.push_back(&batches_[i]);
+            sortedPriorityBatches_.Push(&batches_[i]);
         else
         else
-            sortedBatches_.push_back(&batches_[i]);
+            sortedBatches_.Push(&batches_[i]);
     }
     }
     
     
-    std::sort(sortedPriorityBatches_.begin(), sortedPriorityBatches_.end(), CompareBatchesFrontToBack);
-    std::sort(sortedBatches_.begin(), sortedBatches_.end(), CompareBatchesFrontToBack);
+    Sort(sortedPriorityBatches_.Begin(), sortedPriorityBatches_.End(), CompareBatchesFrontToBack);
+    Sort(sortedBatches_.Begin(), sortedBatches_.End(), CompareBatchesFrontToBack);
     
     
     // Sort each group front to back
     // Sort each group front to back
-    for (std::map<BatchGroupKey, BatchGroup>::iterator i = priorityBatchGroups_.begin(); i != priorityBatchGroups_.end(); ++i)
-        std::sort(i->second.instances_.begin(), i->second.instances_.end(), CompareInstancesFrontToBack);
-    for (std::map<BatchGroupKey, BatchGroup>::iterator i = batchGroups_.begin(); i != batchGroups_.end(); ++i)
-        std::sort(i->second.instances_.begin(), i->second.instances_.end(), CompareInstancesFrontToBack);
+    for (Map<BatchGroupKey, BatchGroup>::Iterator i = priorityBatchGroups_.Begin(); i != priorityBatchGroups_.End(); ++i)
+        Sort(i->second_.instances_.Begin(), i->second_.instances_.End(), CompareInstancesFrontToBack);
+    for (Map<BatchGroupKey, BatchGroup>::Iterator i = batchGroups_.Begin(); i != batchGroups_.End(); ++i)
+        Sort(i->second_.instances_.Begin(), i->second_.instances_.End(), CompareInstancesFrontToBack);
 }
 }
 
 
 void BatchQueue::SetTransforms(void* lockedData, unsigned& freeIndex)
 void BatchQueue::SetTransforms(void* lockedData, unsigned& freeIndex)
 {
 {
-    for (std::map<BatchGroupKey, BatchGroup>::iterator i = priorityBatchGroups_.begin(); i != priorityBatchGroups_.end(); ++i)
-        i->second.SetTransforms(lockedData, freeIndex);
-    for (std::map<BatchGroupKey, BatchGroup>::iterator i = batchGroups_.begin(); i != batchGroups_.end(); ++i)
-        i->second.SetTransforms(lockedData, freeIndex);
+    for (Map<BatchGroupKey, BatchGroup>::Iterator i = priorityBatchGroups_.Begin(); i != priorityBatchGroups_.End(); ++i)
+        i->second_.SetTransforms(lockedData, freeIndex);
+    for (Map<BatchGroupKey, BatchGroup>::Iterator i = batchGroups_.Begin(); i != batchGroups_.End(); ++i)
+        i->second_.SetTransforms(lockedData, freeIndex);
 }
 }
 
 
 unsigned BatchQueue::GetNumInstances() const
 unsigned BatchQueue::GetNumInstances() const
@@ -558,15 +557,15 @@ unsigned BatchQueue::GetNumInstances() const
     
     
     // This is for the purpose of calculating how much space is needed in the instancing buffer. Do not add instance counts
     // This is for the purpose of calculating how much space is needed in the instancing buffer. Do not add instance counts
     // that are below the minimum threshold for instancing
     // that are below the minimum threshold for instancing
-    for (std::map<BatchGroupKey, BatchGroup>::const_iterator i = priorityBatchGroups_.begin(); i != priorityBatchGroups_.end(); ++i)
+    for (Map<BatchGroupKey, BatchGroup>::ConstIterator i = priorityBatchGroups_.Begin(); i != priorityBatchGroups_.End(); ++i)
     {
     {
-        unsigned instances = i->second.instances_.size();
+        unsigned instances = i->second_.instances_.Size();
         if (instances >= MIN_INSTANCES)
         if (instances >= MIN_INSTANCES)
             total += instances;
             total += instances;
     }
     }
-    for (std::map<BatchGroupKey, BatchGroup>::const_iterator i = batchGroups_.begin(); i != batchGroups_.end(); ++i)
+    for (Map<BatchGroupKey, BatchGroup>::ConstIterator i = batchGroups_.Begin(); i != batchGroups_.End(); ++i)
     {
     {
-        unsigned instances = i->second.instances_.size();
+        unsigned instances = i->second_.instances_.Size();
         if (instances >= MIN_INSTANCES)
         if (instances >= MIN_INSTANCES)
             total += instances;
             total += instances;
     }
     }

+ 18 - 7
Engine/Graphics/Batch.h

@@ -25,6 +25,7 @@
 
 
 #include "MathDefs.h"
 #include "MathDefs.h"
 #include "GraphicsDefs.h"
 #include "GraphicsDefs.h"
+#include "PODVector.h"
 #include "SharedPtr.h"
 #include "SharedPtr.h"
 
 
 class Camera;
 class Camera;
@@ -97,6 +98,11 @@ struct Batch
 /// Data for one geometry instance
 /// Data for one geometry instance
 struct InstanceData
 struct InstanceData
 {
 {
+    /// Construct undefined
+    InstanceData()
+    {
+    }
+    
     /// Construct with transform and distance
     /// Construct with transform and distance
     InstanceData(const Matrix4x3* worldTransform, float distance) :
     InstanceData(const Matrix4x3* worldTransform, float distance) :
         worldTransform_(worldTransform),
         worldTransform_(worldTransform),
@@ -132,7 +138,7 @@ struct BatchGroup
     /// Geometry
     /// Geometry
     Geometry* geometry_;
     Geometry* geometry_;
     /// Instance data
     /// Instance data
-    std::vector<InstanceData> instances_;
+    PODVector<InstanceData> instances_;
     /// Material
     /// Material
     Material* material_;
     Material* material_;
     /// Material pass
     /// Material pass
@@ -163,6 +169,11 @@ struct BatchGroupKey
     /// Geometry
     /// Geometry
     Geometry* geometry_;
     Geometry* geometry_;
     
     
+    /// Test for equality with another batch group key
+    bool operator == (const BatchGroupKey& rhs) const { return (light_ == rhs.light_) && (pass_ == rhs.pass_) && (material_ == rhs.material_) && (geometry_ == rhs.geometry_); }
+    /// Test for inequality with another batch group key
+    bool operator != (const BatchGroupKey& rhs) const { return (light_ != rhs.light_) || (pass_ != rhs.pass_) || (material_ != rhs.material_) || (geometry_ != rhs.geometry_); }
+    
     /// Test if less than another batch group key
     /// Test if less than another batch group key
     bool operator < (const BatchGroupKey& rhs) const
     bool operator < (const BatchGroupKey& rhs) const
     {
     {
@@ -221,15 +232,15 @@ public:
     unsigned GetNumInstances() const;
     unsigned GetNumInstances() const;
     
     
     /// Unsorted non-instanced draw calls
     /// Unsorted non-instanced draw calls
-    std::vector<Batch> batches_;
+    PODVector<Batch> batches_;
     /// Sorted non-instanced draw calls with priority flag
     /// Sorted non-instanced draw calls with priority flag
-    std::vector<Batch*> sortedPriorityBatches_;
+    PODVector<Batch*> sortedPriorityBatches_;
     /// Sorted non-instanced draw calls
     /// Sorted non-instanced draw calls
-    std::vector<Batch*> sortedBatches_;
+    PODVector<Batch*> sortedBatches_;
     /// Instanced draw calls with priority flag
     /// Instanced draw calls with priority flag
-    std::map<BatchGroupKey, BatchGroup> priorityBatchGroups_;
+    Map<BatchGroupKey, BatchGroup> priorityBatchGroups_;
     /// Instanced draw calls
     /// Instanced draw calls
-    std::map<BatchGroupKey, BatchGroup> batchGroups_;
+    Map<BatchGroupKey, BatchGroup> batchGroups_;
 };
 };
 
 
 /// Queue for light related draw calls
 /// Queue for light related draw calls
@@ -242,7 +253,7 @@ struct LightBatchQueue
     /// Lit geometry draw calls
     /// Lit geometry draw calls
     BatchQueue litBatches_;
     BatchQueue litBatches_;
     /// Light volume draw calls, should be only one
     /// Light volume draw calls, should be only one
-    std::vector<Batch> volumeBatches_;
+    PODVector<Batch> volumeBatches_;
     /// Last split flag for clearing the stencil buffer
     /// Last split flag for clearing the stencil buffer
     bool lastSplit_;
     bool lastSplit_;
 };
 };

+ 14 - 15
Engine/Graphics/BillboardSet.cpp

@@ -34,17 +34,16 @@
 #include "MemoryBuffer.h"
 #include "MemoryBuffer.h"
 #include "Profiler.h"
 #include "Profiler.h"
 #include "ResourceCache.h"
 #include "ResourceCache.h"
+#include "Sort.h"
 #include "VectorBuffer.h"
 #include "VectorBuffer.h"
 #include "VertexBuffer.h"
 #include "VertexBuffer.h"
 #include "XMLElement.h"
 #include "XMLElement.h"
 
 
-#include <algorithm>
-
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
 static const Vector3 dotScale(1 / 3.0f, 1 / 3.0f, 1 / 3.0f);
 static const Vector3 dotScale(1 / 3.0f, 1 / 3.0f, 1 / 3.0f);
 
 
-static bool CompareBillboards(Billboard* lhs, Billboard* rhs)
+inline bool CompareBillboards(Billboard* lhs, Billboard* rhs)
 {
 {
     return lhs->sortDistance_ > rhs->sortDistance_;
     return lhs->sortDistance_ > rhs->sortDistance_;
 }
 }
@@ -82,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_, std::vector<unsigned char>());
+    ATTRIBUTE(BillboardSet, VAR_BUFFER, "Billboards", billboards_, Vector<unsigned char>());
 }
 }
 
 
 void BillboardSet::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void BillboardSet::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
@@ -112,7 +111,7 @@ void BillboardSet::OnSetAttribute(const AttributeInfo& attr, const Variant& valu
             MemoryBuffer buf(value.GetBuffer());
             MemoryBuffer buf(value.GetBuffer());
             unsigned numBillboards = buf.ReadVLE();
             unsigned numBillboards = buf.ReadVLE();
             SetNumBillboards(numBillboards);
             SetNumBillboards(numBillboards);
-            for (std::vector<Billboard>::iterator i = billboards_.begin(); i != billboards_.end(); ++i)
+            for (Vector<Billboard>::Iterator i = billboards_.Begin(); i != billboards_.End(); ++i)
             {
             {
                 i->position_ = buf.ReadVector3();
                 i->position_ = buf.ReadVector3();
                 i->size_ = buf.ReadVector2();
                 i->size_ = buf.ReadVector2();
@@ -141,8 +140,8 @@ Variant BillboardSet::OnGetAttribute(const AttributeInfo& attr)
     case offsetof(BillboardSet, billboards_):
     case offsetof(BillboardSet, billboards_):
         {
         {
             VectorBuffer buf;
             VectorBuffer buf;
-            buf.WriteVLE(billboards_.size());
-            for (std::vector<Billboard>::const_iterator i = billboards_.begin(); i != billboards_.end(); ++i)
+            buf.WriteVLE(billboards_.Size());
+            for (Vector<Billboard>::ConstIterator i = billboards_.Begin(); i != billboards_.End(); ++i)
             {
             {
                 buf.WriteVector3(i->position_);
                 buf.WriteVector3(i->position_);
                 buf.WriteVector2(i->size_);
                 buf.WriteVector2(i->size_);
@@ -228,9 +227,9 @@ void BillboardSet::SetMaterial(Material* material)
 
 
 void BillboardSet::SetNumBillboards(unsigned num)
 void BillboardSet::SetNumBillboards(unsigned num)
 {
 {
-    unsigned oldNum = billboards_.size();
+    unsigned oldNum = billboards_.Size();
     
     
-    billboards_.resize(num);
+    billboards_.Resize(num);
     
     
     // Set default values to new billboards
     // Set default values to new billboards
     for (unsigned i = oldNum; i < num; ++i)
     for (unsigned i = oldNum; i < num; ++i)
@@ -277,7 +276,7 @@ void BillboardSet::Updated()
 
 
 Billboard* BillboardSet::GetBillboard(unsigned index)
 Billboard* BillboardSet::GetBillboard(unsigned index)
 {
 {
-    return index < billboards_.size() ? &billboards_[index] : (Billboard*)0;
+    return index < billboards_.Size() ? &billboards_[index] : (Billboard*)0;
 }
 }
 
 
 void BillboardSet::OnMarkedDirty(Node* node)
 void BillboardSet::OnMarkedDirty(Node* node)
@@ -298,7 +297,7 @@ void BillboardSet::OnWorldBoundingBoxUpdate()
     const Matrix4x3& worldTransform = GetWorldTransform();
     const Matrix4x3& worldTransform = GetWorldTransform();
     const Vector3& worldScale = worldTransform.GetScale();
     const Vector3& worldScale = worldTransform.GetScale();
     
     
-    for (unsigned i = 0; i < billboards_.size(); ++i)
+    for (unsigned i = 0; i < billboards_.Size(); ++i)
     {
     {
         if (!billboards_[i].enabled_)
         if (!billboards_[i].enabled_)
             continue;
             continue;
@@ -333,7 +332,7 @@ void BillboardSet::UpdateBufferSize()
         geometry_->SetIndexBuffer(indexBuffer_);
         geometry_->SetIndexBuffer(indexBuffer_);
     }
     }
     
     
-    unsigned numBillboards = billboards_.size();
+    unsigned numBillboards = billboards_.Size();
     
     
     vertexBuffer_->SetSize(numBillboards * 4, MASK_POSITION | MASK_COLOR | MASK_TEXCOORD1 | MASK_TEXCOORD2, true);
     vertexBuffer_->SetSize(numBillboards * 4, MASK_POSITION | MASK_COLOR | MASK_TEXCOORD1 | MASK_TEXCOORD2, true);
     indexBuffer_->SetSize(numBillboards * 6, false);
     indexBuffer_->SetSize(numBillboards * 6, false);
@@ -376,7 +375,7 @@ void BillboardSet::UpdateVertexBuffer(const FrameInfo& frame)
     
     
     PROFILE(UpdateBillboardSet);
     PROFILE(UpdateBillboardSet);
     
     
-    unsigned numBillboards = billboards_.size();
+    unsigned numBillboards = billboards_.Size();
     unsigned enabledBillboards = 0;
     unsigned enabledBillboards = 0;
     const Matrix4x3& worldTransform = GetWorldTransform();
     const Matrix4x3& worldTransform = GetWorldTransform();
     
     
@@ -387,7 +386,7 @@ void BillboardSet::UpdateVertexBuffer(const FrameInfo& frame)
             ++enabledBillboards;
             ++enabledBillboards;
     }
     }
     
     
-    sortedBillboards_.resize(enabledBillboards);
+    sortedBillboards_.Resize(enabledBillboards);
     unsigned index = 0;
     unsigned index = 0;
     
     
     // Then set initial sort order and distances
     // Then set initial sort order and distances
@@ -415,7 +414,7 @@ void BillboardSet::UpdateVertexBuffer(const FrameInfo& frame)
         return;
         return;
     
     
     if (sorted_)
     if (sorted_)
-        std::sort(sortedBillboards_.begin(), sortedBillboards_.end(), CompareBillboards);
+        Sort(sortedBillboards_.Begin(), sortedBillboards_.End(), CompareBillboards);
     
     
     float* dest = (float*)vertexBuffer_->Lock(0, enabledBillboards * 4, LOCK_DISCARD);
     float* dest = (float*)vertexBuffer_->Lock(0, enabledBillboards * 4, LOCK_DISCARD);
     if (!dest)
     if (!dest)

+ 4 - 4
Engine/Graphics/BillboardSet.h

@@ -94,9 +94,9 @@ public:
     /// Return material
     /// Return material
     Material* GetMaterial() const { return material_; }
     Material* GetMaterial() const { return material_; }
     /// Return number of billboards
     /// Return number of billboards
-    unsigned GetNumBillboards() const { return billboards_.size(); }
+    unsigned GetNumBillboards() const { return billboards_.Size(); }
     /// Return all billboards
     /// Return all billboards
-    std::vector<Billboard>& GetBillboards() { return billboards_; }
+    Vector<Billboard>& GetBillboards() { return billboards_; }
     /// Return billboard by index
     /// Return billboard by index
     Billboard* GetBillboard(unsigned index);
     Billboard* GetBillboard(unsigned index);
     /// Return whether billboards are relative to the scene node
     /// Return whether billboards are relative to the scene node
@@ -117,7 +117,7 @@ protected:
     void MarkPositionsDirty();
     void MarkPositionsDirty();
     
     
     /// Billboards
     /// Billboards
-    std::vector<Billboard> billboards_;
+    Vector<Billboard> billboards_;
     /// Animation LOD bias
     /// Animation LOD bias
     float animationLodBias_;
     float animationLodBias_;
     /// Animation LOD timer
     /// Animation LOD timer
@@ -154,5 +154,5 @@ private:
     /// Previous offset to camera for determining whether sorting is necessary
     /// Previous offset to camera for determining whether sorting is necessary
     Vector3 previousOffset_;
     Vector3 previousOffset_;
     /// Billboard pointers for sorting
     /// Billboard pointers for sorting
-    std::vector<Billboard*> sortedBillboards_;
+    Vector<Billboard*> sortedBillboards_;
 };
 };

+ 55 - 55
Engine/Graphics/DebugRenderer.cpp

@@ -68,9 +68,9 @@ void DebugRenderer::SetView(Camera* camera)
 void DebugRenderer::AddLine(const Vector3& start, const Vector3& end, const Color& color, bool depthTest)
 void DebugRenderer::AddLine(const Vector3& start, const Vector3& end, const Color& color, bool depthTest)
 {
 {
     if (depthTest)
     if (depthTest)
-        lines_.push_back(DebugLine(start, end, color.ToUInt()));
+        lines_.Push(DebugLine(start, end, color.ToUInt()));
     else
     else
-        noDepthLines_.push_back(DebugLine(start, end, color.ToUInt()));
+        noDepthLines_.Push(DebugLine(start, end, color.ToUInt()));
 }
 }
 
 
 void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Color& color, bool depthTest)
 void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Color& color, bool depthTest)
@@ -87,22 +87,22 @@ void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Color& color, b
     
     
     unsigned d3dColor = color.ToUInt();
     unsigned d3dColor = color.ToUInt();
     
     
-    std::vector<DebugLine>* dest = &lines_;
+    Vector<DebugLine>* dest = &lines_;
     if (!depthTest)
     if (!depthTest)
         dest = &noDepthLines_;
         dest = &noDepthLines_;
     
     
-    dest->push_back(DebugLine(min, v0, d3dColor));
-    dest->push_back(DebugLine(v0, v1, d3dColor));
-    dest->push_back(DebugLine(v1, v2, d3dColor));
-    dest->push_back(DebugLine(v2, min, d3dColor));
-    dest->push_back(DebugLine(v3, v4, d3dColor));
-    dest->push_back(DebugLine(v4, max, d3dColor));
-    dest->push_back(DebugLine(max, v5, d3dColor));
-    dest->push_back(DebugLine(v5, v3, d3dColor));
-    dest->push_back(DebugLine(min, v3, d3dColor));
-    dest->push_back(DebugLine(v0, v4, d3dColor));
-    dest->push_back(DebugLine(v1, max, d3dColor));
-    dest->push_back(DebugLine(v2, v5, d3dColor));
+    dest->Push(DebugLine(min, v0, d3dColor));
+    dest->Push(DebugLine(v0, v1, d3dColor));
+    dest->Push(DebugLine(v1, v2, d3dColor));
+    dest->Push(DebugLine(v2, min, d3dColor));
+    dest->Push(DebugLine(v3, v4, d3dColor));
+    dest->Push(DebugLine(v4, max, d3dColor));
+    dest->Push(DebugLine(max, v5, d3dColor));
+    dest->Push(DebugLine(v5, v3, d3dColor));
+    dest->Push(DebugLine(min, v3, d3dColor));
+    dest->Push(DebugLine(v0, v4, d3dColor));
+    dest->Push(DebugLine(v1, max, d3dColor));
+    dest->Push(DebugLine(v2, v5, d3dColor));
 }
 }
 
 
 void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Matrix4x3& transform, const Color& color, bool depthTest)
 void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Matrix4x3& transform, const Color& color, bool depthTest)
@@ -121,22 +121,22 @@ void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Matrix4x3& tran
     
     
     unsigned d3dColor = color.ToUInt();
     unsigned d3dColor = color.ToUInt();
     
     
-    std::vector<DebugLine>* dest = &lines_;
+    Vector<DebugLine>* dest = &lines_;
     if (!depthTest)
     if (!depthTest)
         dest = &noDepthLines_;
         dest = &noDepthLines_;
     
     
-    dest->push_back(DebugLine(v0, v1, d3dColor));
-    dest->push_back(DebugLine(v1, v2, d3dColor));
-    dest->push_back(DebugLine(v2, v3, d3dColor));
-    dest->push_back(DebugLine(v3, v0, d3dColor));
-    dest->push_back(DebugLine(v4, v5, d3dColor));
-    dest->push_back(DebugLine(v5, v6, d3dColor));
-    dest->push_back(DebugLine(v6, v7, d3dColor));
-    dest->push_back(DebugLine(v7, v4, d3dColor));
-    dest->push_back(DebugLine(v0, v4, d3dColor));
-    dest->push_back(DebugLine(v1, v5, d3dColor));
-    dest->push_back(DebugLine(v2, v6, d3dColor));
-    dest->push_back(DebugLine(v3, v7, d3dColor));
+    dest->Push(DebugLine(v0, v1, d3dColor));
+    dest->Push(DebugLine(v1, v2, d3dColor));
+    dest->Push(DebugLine(v2, v3, d3dColor));
+    dest->Push(DebugLine(v3, v0, d3dColor));
+    dest->Push(DebugLine(v4, v5, d3dColor));
+    dest->Push(DebugLine(v5, v6, d3dColor));
+    dest->Push(DebugLine(v6, v7, d3dColor));
+    dest->Push(DebugLine(v7, v4, d3dColor));
+    dest->Push(DebugLine(v0, v4, d3dColor));
+    dest->Push(DebugLine(v1, v5, d3dColor));
+    dest->Push(DebugLine(v2, v6, d3dColor));
+    dest->Push(DebugLine(v3, v7, d3dColor));
 }
 }
 
 
 void DebugRenderer::AddFrustum(const Frustum& frustum, const Color& color, bool depthTest)
 void DebugRenderer::AddFrustum(const Frustum& frustum, const Color& color, bool depthTest)
@@ -144,38 +144,38 @@ void DebugRenderer::AddFrustum(const Frustum& frustum, const Color& color, bool
     const Vector3* vertices = frustum.GetVertices();
     const Vector3* vertices = frustum.GetVertices();
     unsigned d3dColor = color.ToUInt();
     unsigned d3dColor = color.ToUInt();
     
     
-    std::vector<DebugLine>* dest = &lines_;
+    Vector<DebugLine>* dest = &lines_;
     if (!depthTest)
     if (!depthTest)
         dest = &noDepthLines_;
         dest = &noDepthLines_;
     
     
-    dest->push_back(DebugLine(vertices[0], vertices[1], d3dColor));
-    dest->push_back(DebugLine(vertices[1], vertices[2], d3dColor));
-    dest->push_back(DebugLine(vertices[2], vertices[3], d3dColor));
-    dest->push_back(DebugLine(vertices[3], vertices[0], d3dColor));
-    dest->push_back(DebugLine(vertices[4], vertices[5], d3dColor));
-    dest->push_back(DebugLine(vertices[5], vertices[6], d3dColor));
-    dest->push_back(DebugLine(vertices[6], vertices[7], d3dColor));
-    dest->push_back(DebugLine(vertices[7], vertices[4], d3dColor));
-    dest->push_back(DebugLine(vertices[0], vertices[4], d3dColor));
-    dest->push_back(DebugLine(vertices[1], vertices[5], d3dColor));
-    dest->push_back(DebugLine(vertices[2], vertices[6], d3dColor));
-    dest->push_back(DebugLine(vertices[3], vertices[7], d3dColor));
+    dest->Push(DebugLine(vertices[0], vertices[1], d3dColor));
+    dest->Push(DebugLine(vertices[1], vertices[2], d3dColor));
+    dest->Push(DebugLine(vertices[2], vertices[3], d3dColor));
+    dest->Push(DebugLine(vertices[3], vertices[0], d3dColor));
+    dest->Push(DebugLine(vertices[4], vertices[5], d3dColor));
+    dest->Push(DebugLine(vertices[5], vertices[6], d3dColor));
+    dest->Push(DebugLine(vertices[6], vertices[7], d3dColor));
+    dest->Push(DebugLine(vertices[7], vertices[4], d3dColor));
+    dest->Push(DebugLine(vertices[0], vertices[4], d3dColor));
+    dest->Push(DebugLine(vertices[1], vertices[5], d3dColor));
+    dest->Push(DebugLine(vertices[2], vertices[6], d3dColor));
+    dest->Push(DebugLine(vertices[3], vertices[7], d3dColor));
 }
 }
 
 
 void DebugRenderer::AddSkeleton(const Skeleton& skeleton, const Color& color, bool depthTest)
 void DebugRenderer::AddSkeleton(const Skeleton& skeleton, const Color& color, bool depthTest)
 {
 {
-    const std::vector<Bone>& bones = skeleton.GetBones();
-    if (!bones.size())
+    const Vector<Bone>& bones = skeleton.GetBones();
+    if (!bones.Size())
         return;
         return;
     
     
     DebugLine newLine;
     DebugLine newLine;
     newLine.color_ = color.ToUInt();
     newLine.color_ = color.ToUInt();
     
     
-    std::vector<DebugLine>* dest = &lines_;
+    Vector<DebugLine>* dest = &lines_;
     if (!depthTest)
     if (!depthTest)
         dest = &noDepthLines_;
         dest = &noDepthLines_;
     
     
-    for (unsigned i = 0; i < bones.size(); ++i)
+    for (unsigned i = 0; i < bones.Size(); ++i)
     {
     {
         Node* boneNode = bones[i].node_;
         Node* boneNode = bones[i].node_;
         if (!boneNode)
         if (!boneNode)
@@ -189,7 +189,7 @@ void DebugRenderer::AddSkeleton(const Skeleton& skeleton, const Color& color, bo
         else
         else
             newLine.end_ = newLine.start_;
             newLine.end_ = newLine.start_;
         
         
-        dest->push_back(newLine);
+        dest->Push(newLine);
     }
     }
 }
 }
 
 
@@ -198,7 +198,7 @@ void DebugRenderer::Render()
 {
 {
     PROFILE(RenderDebugGeometry);
     PROFILE(RenderDebugGeometry);
     
     
-    if ((!lines_.size()) && (!noDepthLines_.size()))
+    if ((!lines_.Size()) && (!noDepthLines_.Size()))
         return;
         return;
     
     
     Graphics* graphics = GetSubsystem<Graphics>();
     Graphics* graphics = GetSubsystem<Graphics>();
@@ -219,12 +219,12 @@ void DebugRenderer::Render()
     graphics->SetPixelShaderParameter(PSP_MATDIFFCOLOR, Color(1.0f, 1.0f, 1.0f, 1.0f));
     graphics->SetPixelShaderParameter(PSP_MATDIFFCOLOR, Color(1.0f, 1.0f, 1.0f, 1.0f));
     
     
     // Draw all line geometry with depth testing
     // Draw all line geometry with depth testing
-    if (lines_.size())
+    if (lines_.Size())
     {
     {
-        graphics->BeginImmediate(LINE_LIST, lines_.size() * 2, MASK_POSITION | MASK_COLOR);
+        graphics->BeginImmediate(LINE_LIST, lines_.Size() * 2, MASK_POSITION | MASK_COLOR);
         float* dest = (float*)graphics->GetImmediateDataPtr();
         float* dest = (float*)graphics->GetImmediateDataPtr();
         
         
-        for (unsigned i = 0; i < lines_.size(); ++i)
+        for (unsigned i = 0; i < lines_.Size(); ++i)
         {
         {
             const DebugLine& line = lines_[i];
             const DebugLine& line = lines_[i];
             
             
@@ -240,12 +240,12 @@ void DebugRenderer::Render()
     
     
     // Draw all line geometry without depth testing
     // Draw all line geometry without depth testing
     graphics->SetDepthTest(CMP_ALWAYS);
     graphics->SetDepthTest(CMP_ALWAYS);
-    if (noDepthLines_.size())
+    if (noDepthLines_.Size())
     {
     {
-        graphics->BeginImmediate(LINE_LIST, noDepthLines_.size() * 2, MASK_POSITION | MASK_COLOR);
+        graphics->BeginImmediate(LINE_LIST, noDepthLines_.Size() * 2, MASK_POSITION | MASK_COLOR);
         float* dest = (float*)graphics->GetImmediateDataPtr();
         float* dest = (float*)graphics->GetImmediateDataPtr();
         
         
-        for (unsigned i = 0; i < noDepthLines_.size(); ++i)
+        for (unsigned i = 0; i < noDepthLines_.Size(); ++i)
         {
         {
             const DebugLine& line = noDepthLines_[i];
             const DebugLine& line = noDepthLines_[i];
             
             
@@ -267,6 +267,6 @@ bool DebugRenderer::IsInside(const BoundingBox& box) const
 
 
 void DebugRenderer::HandleEndFrame(StringHash eventType, VariantMap& eventData)
 void DebugRenderer::HandleEndFrame(StringHash eventType, VariantMap& eventData)
 {
 {
-    lines_.clear();
-    noDepthLines_.clear();
+    lines_.Clear();
+    noDepthLines_.Clear();
 }
 }

+ 3 - 3
Engine/Graphics/DebugRenderer.h

@@ -28,7 +28,7 @@
 #include "Frustum.h"
 #include "Frustum.h"
 #include "SharedPtr.h"
 #include "SharedPtr.h"
 
 
-#include <vector>
+#include "Vector.h"
 
 
 class BoundingBox;
 class BoundingBox;
 class Camera;
 class Camera;
@@ -105,9 +105,9 @@ private:
     void HandleEndFrame(StringHash eventType, VariantMap& eventData);
     void HandleEndFrame(StringHash eventType, VariantMap& eventData);
     
     
     /// Lines rendered with depth test
     /// Lines rendered with depth test
-    std::vector<DebugLine> lines_;
+    Vector<DebugLine> lines_;
     /// Lines rendered without depth test
     /// Lines rendered without depth test
-    std::vector<DebugLine> noDepthLines_;
+    Vector<DebugLine> noDepthLines_;
     /// View transform
     /// View transform
     Matrix4x3 view_;
     Matrix4x3 view_;
     /// Projection transform
     /// Projection transform

+ 12 - 17
Engine/Graphics/Drawable.cpp

@@ -30,7 +30,7 @@
 #include "OctreeQuery.h"
 #include "OctreeQuery.h"
 #include "Scene.h"
 #include "Scene.h"
 
 
-#include <algorithm>
+#include "Sort.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
@@ -87,7 +87,7 @@ void Drawable::ProcessRayQuery(RayOctreeQuery& query, float initialDistance)
     result.drawable_ = this;
     result.drawable_ = this;
     result.node_ = GetNode();
     result.node_ = GetNode();
     result.distance_ = initialDistance;
     result.distance_ = initialDistance;
-    query.result_.push_back(result);
+    query.result_.Push(result);
 }
 }
 
 
 void Drawable::UpdateDistance(const FrameInfo& frame)
 void Drawable::UpdateDistance(const FrameInfo& frame)
@@ -194,7 +194,7 @@ void Drawable::SetSortValue(float value)
 void Drawable::ClearBasePass()
 void Drawable::ClearBasePass()
 {
 {
     basePassFlags_ = 0;
     basePassFlags_ = 0;
-    lights_.clear();
+    lights_.Clear();
 }
 }
 
 
 void Drawable::SetBasePass(unsigned batchIndex)
 void Drawable::SetBasePass(unsigned batchIndex)
@@ -204,32 +204,32 @@ void Drawable::SetBasePass(unsigned batchIndex)
 
 
 void Drawable::AddLight(Light* light)
 void Drawable::AddLight(Light* light)
 {
 {
-    lights_.push_back(light);
+    lights_.Push(light);
 }
 }
 
 
 void Drawable::LimitLights()
 void Drawable::LimitLights()
 {
 {
-    std::set<Light*> uniqueLights;
+    Set<Light*> uniqueLights;
     
     
     const Vector3& worldPos = GetWorldPosition();
     const Vector3& worldPos = GetWorldPosition();
-    for (unsigned i = 0; i < lights_.size(); ++i)
+    for (unsigned i = 0; i < lights_.Size(); ++i)
         lights_[i]->SetIntensitySortValue(worldPos);
         lights_[i]->SetIntensitySortValue(worldPos);
     
     
-    std::sort(lights_.begin(), lights_.end(), CompareDrawables);
+    Sort(lights_.Begin(), lights_.End(), CompareDrawables);
     
     
-    for (unsigned i = 0; i < lights_.size(); ++i)
+    for (unsigned i = 0; i < lights_.Size(); ++i)
     {
     {
         // For split lights, take into account the original light instead, so that we do not get "partial" lighting
         // For split lights, take into account the original light instead, so that we do not get "partial" lighting
         Light* originalLight = lights_[i]->GetOriginalLight();
         Light* originalLight = lights_[i]->GetOriginalLight();
         if (originalLight)
         if (originalLight)
-            uniqueLights.insert(originalLight);
+            uniqueLights.Insert(originalLight);
         else
         else
-            uniqueLights.insert(lights_[i]);
+            uniqueLights.Insert(lights_[i]);
         
         
         // Stop when allowed light count exceeded
         // Stop when allowed light count exceeded
-        if (uniqueLights.size() > maxLights_)
+        if (uniqueLights.Size() > maxLights_)
         {
         {
-            lights_.resize(i);
+            lights_.Resize(i);
             return;
             return;
         }
         }
     }
     }
@@ -288,8 +288,3 @@ void Drawable::RemoveFromOctree()
         octant_->RemoveDrawable(this);
         octant_->RemoveDrawable(this);
     }
     }
 }
 }
-
-bool CompareDrawables(const Drawable* lhs, const Drawable* rhs)
-{
-    return lhs->GetSortValue() < rhs->GetSortValue();
-}

+ 7 - 3
Engine/Graphics/Drawable.h

@@ -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 std::vector<Light*>& GetLights() const { return lights_; }
+    const Vector<Light*>& GetLights() const { return lights_; }
     
     
 protected:
 protected:
     /// Handle node being assigned
     /// Handle node being assigned
@@ -215,11 +215,15 @@ 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
-    std::vector<Light*> lights_;
+    Vector<Light*> lights_;
     /// Bounding box dirty flag
     /// Bounding box dirty flag
     bool worldBoundingBoxDirty_;
     bool worldBoundingBoxDirty_;
     /// Lod levels dirty flag
     /// Lod levels dirty flag
     bool lodLevelsDirty_;
     bool lodLevelsDirty_;
 };
 };
 
 
-bool CompareDrawables(const Drawable* lhs, const Drawable* rhs);
+inline bool CompareDrawables(Drawable* lhs, Drawable* rhs)
+{
+    return lhs->GetSortValue() < rhs->GetSortValue();
+}
+

+ 10 - 10
Engine/Graphics/Geometry.cpp

@@ -59,9 +59,9 @@ bool Geometry::SetNumVertexBuffers(unsigned num)
         return false;
         return false;
     }
     }
     
     
-    unsigned oldSize = vertexBuffer_.size();
-    vertexBuffer_.resize(num);
-    elementMasks_.resize(num);
+    unsigned oldSize = vertexBuffer_.Size();
+    vertexBuffer_.Resize(num);
+    elementMasks_.Resize(num);
     
     
     for (unsigned i = oldSize; i < num; ++i)
     for (unsigned i = oldSize; i < num; ++i)
         elementMasks_[i] = MASK_NONE;
         elementMasks_[i] = MASK_NONE;
@@ -72,7 +72,7 @@ bool Geometry::SetNumVertexBuffers(unsigned num)
 
 
 bool Geometry::SetVertexBuffer(unsigned index, VertexBuffer* buffer, unsigned elementMask)
 bool Geometry::SetVertexBuffer(unsigned index, VertexBuffer* buffer, unsigned elementMask)
 {
 {
-    if (index >= vertexBuffer_.size())
+    if (index >= vertexBuffer_.Size())
     {
     {
         LOGERROR("Stream index out of bounds");
         LOGERROR("Stream index out of bounds");
         return false;
         return false;
@@ -163,19 +163,19 @@ void Geometry::Draw(Graphics* graphics)
 
 
 VertexBuffer* Geometry::GetVertexBuffer(unsigned index) const
 VertexBuffer* Geometry::GetVertexBuffer(unsigned index) const
 {
 {
-    return index < vertexBuffer_.size() ? vertexBuffer_[index] : (VertexBuffer*)0;
+    return index < vertexBuffer_.Size() ? vertexBuffer_[index] : (VertexBuffer*)0;
 }
 }
 
 
 unsigned Geometry::GetVertexElementMask(unsigned index) const
 unsigned Geometry::GetVertexElementMask(unsigned index) const
 {
 {
-    return index < elementMasks_.size() ? elementMasks_[index] : 0;
+    return index < elementMasks_.Size() ? elementMasks_[index] : 0;
 }
 }
 
 
 unsigned short Geometry::GetBufferHash() const
 unsigned short Geometry::GetBufferHash() const
 {
 {
     unsigned short hash = 0;
     unsigned short hash = 0;
     
     
-    for (unsigned i = 0; i < vertexBuffer_.size(); ++i)
+    for (unsigned i = 0; i < vertexBuffer_.Size(); ++i)
     {
     {
         VertexBuffer* vBuf = vertexBuffer_[i];
         VertexBuffer* vBuf = vertexBuffer_[i];
         hash += *((unsigned short*)&vBuf);
         hash += *((unsigned short*)&vBuf);
@@ -207,7 +207,7 @@ float Geometry::GetDistance(const Ray& ray)
 
 
 void Geometry::LockRawData(const unsigned char*& vertexData, unsigned& vertexSize, const unsigned char*& indexData, unsigned& indexSize)
 void Geometry::LockRawData(const unsigned char*& vertexData, unsigned& vertexSize, const unsigned char*& indexData, unsigned& indexSize)
 {
 {
-    if ((indexBuffer_) && (positionBufferIndex_ < vertexBuffer_.size()))
+    if ((indexBuffer_) && (positionBufferIndex_ < vertexBuffer_.Size()))
     {
     {
         VertexBuffer* positionBuffer = vertexBuffer_[positionBufferIndex_];
         VertexBuffer* positionBuffer = vertexBuffer_[positionBufferIndex_];
         
         
@@ -234,7 +234,7 @@ void Geometry::LockRawData(const unsigned char*& vertexData, unsigned& vertexSiz
 
 
 void Geometry::UnlockRawData()
 void Geometry::UnlockRawData()
 {
 {
-    if ((indexBuffer_) && (positionBufferIndex_ < vertexBuffer_.size()))
+    if ((indexBuffer_) && (positionBufferIndex_ < vertexBuffer_.Size()))
     {
     {
         vertexBuffer_[positionBufferIndex_]->Unlock();
         vertexBuffer_[positionBufferIndex_]->Unlock();
         indexBuffer_->Unlock();
         indexBuffer_->Unlock();
@@ -243,7 +243,7 @@ void Geometry::UnlockRawData()
 
 
 void Geometry::GetPositionBufferIndex()
 void Geometry::GetPositionBufferIndex()
 {
 {
-    for (unsigned i = 0; i < vertexBuffer_.size(); ++i)
+    for (unsigned i = 0; i < vertexBuffer_.Size(); ++i)
     {
     {
         if ((vertexBuffer_[i]) && (vertexBuffer_[i]->GetElementMask() & MASK_POSITION))
         if ((vertexBuffer_[i]) && (vertexBuffer_[i]->GetElementMask() & MASK_POSITION))
         {
         {

+ 5 - 5
Engine/Graphics/Geometry.h

@@ -58,11 +58,11 @@ public:
     void Draw(Graphics* graphics);
     void Draw(Graphics* graphics);
     
     
     /// Return all vertex buffers
     /// Return all vertex buffers
-    const std::vector<SharedPtr<VertexBuffer> >& GetVertexBuffers() const { return vertexBuffer_; }
+    const Vector<SharedPtr<VertexBuffer> >& GetVertexBuffers() const { return vertexBuffer_; }
     /// Return vertex element masks
     /// Return vertex element masks
-    const std::vector<unsigned>& GetVertexElementMasks() const { return elementMasks_; }
+    const Vector<unsigned>& GetVertexElementMasks() const { return elementMasks_; }
     /// Return number of vertex buffers
     /// Return number of vertex buffers
-    unsigned GetNumVertexBuffers() const { return vertexBuffer_.size(); }
+    unsigned GetNumVertexBuffers() const { return vertexBuffer_.Size(); }
     /// Return vertex buffer by index
     /// Return vertex buffer by index
     VertexBuffer* GetVertexBuffer(unsigned index) const;
     VertexBuffer* GetVertexBuffer(unsigned index) const;
     /// Return vertex element mask by index
     /// Return vertex element mask by index
@@ -95,9 +95,9 @@ private:
     void GetPositionBufferIndex();
     void GetPositionBufferIndex();
     
     
     /// Vertex buffers
     /// Vertex buffers
-    std::vector<SharedPtr<VertexBuffer> > vertexBuffer_;
+    Vector<SharedPtr<VertexBuffer> > vertexBuffer_;
     /// Vertex element masks
     /// Vertex element masks
-    std::vector<unsigned> elementMasks_;
+    Vector<unsigned> elementMasks_;
     /// Index buffer
     /// Index buffer
     SharedPtr<IndexBuffer> indexBuffer_;
     SharedPtr<IndexBuffer> indexBuffer_;
     /// Primitive type
     /// Primitive type

+ 54 - 54
Engine/Graphics/Graphics.cpp

@@ -188,11 +188,11 @@ Graphics::Graphics(Context* context) :
 Graphics::~Graphics()
 Graphics::~Graphics()
 {
 {
     // Release all GPU objects that still exist
     // Release all GPU objects that still exist
-    for (std::vector<GPUObject*>::iterator i = gpuObjects_.begin(); i != gpuObjects_.end(); ++i)
+    for (Vector<GPUObject*>::Iterator i = gpuObjects_.Begin(); i != gpuObjects_.End(); ++i)
         (*i)->Release();
         (*i)->Release();
-    gpuObjects_.clear();
+    gpuObjects_.Clear();
     
     
-    vertexDeclarations_.clear();
+    vertexDeclarations_.Clear();
     
     
     if (impl_->frameQuery_)
     if (impl_->frameQuery_)
     {
     {
@@ -307,9 +307,9 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     // Check fullscreen mode validity. If not valid, revert to windowed
     // Check fullscreen mode validity. If not valid, revert to windowed
     if (fullscreen)
     if (fullscreen)
     {
     {
-        std::vector<IntVector2> resolutions = GetResolutions();
+        Vector<IntVector2> resolutions = GetResolutions();
         fullscreen = false;
         fullscreen = false;
-        for (unsigned i = 0; i < resolutions.size(); ++i)
+        for (unsigned i = 0; i < resolutions.Size(); ++i)
         {
         {
             if ((width == resolutions[i].x_) && (height == resolutions[i].y_))
             if ((width == resolutions[i].x_) && (height == resolutions[i].y_))
             {
             {
@@ -455,7 +455,7 @@ void Graphics::Close()
         diffBuffer_.Reset();
         diffBuffer_.Reset();
         normalBuffer_.Reset();
         normalBuffer_.Reset();
         depthBuffer_.Reset();
         depthBuffer_.Reset();
-        immediatevertexBuffer_.clear();
+        immediatevertexBuffer_.Clear();
         
         
         DestroyWindow(impl_->window_);
         DestroyWindow(impl_->window_);
         impl_->window_ = 0;
         impl_->window_ = 0;
@@ -602,8 +602,8 @@ bool Graphics::BeginFrame()
     ResetStreamFrequencies();
     ResetStreamFrequencies();
     
     
     // Reset immediate mode vertex buffer positions
     // Reset immediate mode vertex buffer positions
-    for (std::map<unsigned, unsigned>::iterator i = immediateVertexBufferPos_.begin(); i != immediateVertexBufferPos_.end(); ++i)
-        i->second = 0;
+    for (Map<unsigned, unsigned>::Iterator i = immediateVertexBufferPos_.Begin(); i != immediateVertexBufferPos_.End(); ++i)
+        i->second_ = 0;
     
     
     numPrimitives_ = 0;
     numPrimitives_ = 0;
     numBatches_ = 0;
     numBatches_ = 0;
@@ -740,22 +740,22 @@ void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned i
 
 
 void Graphics::SetVertexBuffer(VertexBuffer* buffer)
 void Graphics::SetVertexBuffer(VertexBuffer* buffer)
 {
 {
-    std::vector<VertexBuffer*> vertexBuffers(1);
-    std::vector<unsigned> elementMasks(1);
+    Vector<VertexBuffer*> vertexBuffers(1);
+    Vector<unsigned> elementMasks(1);
     vertexBuffers[0] = buffer;
     vertexBuffers[0] = buffer;
     elementMasks[0] = MASK_DEFAULT;
     elementMasks[0] = MASK_DEFAULT;
     SetVertexBuffers(vertexBuffers, elementMasks);
     SetVertexBuffers(vertexBuffers, elementMasks);
 }
 }
 
 
-bool Graphics::SetVertexBuffers(const std::vector<VertexBuffer*>& buffers, const std::vector<unsigned>& elementMasks,
+bool Graphics::SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const Vector<unsigned>& elementMasks,
     unsigned instanceOffset)
     unsigned instanceOffset)
 {
 {
-    if (buffers.size() > MAX_VERTEX_STREAMS)
+    if (buffers.Size() > MAX_VERTEX_STREAMS)
     {
     {
         LOGERROR("Too many vertex buffers");
         LOGERROR("Too many vertex buffers");
         return false;
         return false;
     }
     }
-    if (buffers.size() != elementMasks.size())
+    if (buffers.Size() != elementMasks.Size())
     {
     {
         LOGERROR("Amount of element masks and vertex buffers does not match");
         LOGERROR("Amount of element masks and vertex buffers does not match");
         return false;
         return false;
@@ -763,7 +763,7 @@ bool Graphics::SetVertexBuffers(const std::vector<VertexBuffer*>& buffers, const
     
     
     // Build vertex declaration hash code out of the buffers & masks
     // Build vertex declaration hash code out of the buffers & masks
     unsigned long long hash = 0;
     unsigned long long hash = 0;
-    for (unsigned i = 0; i < buffers.size(); ++i)
+    for (unsigned i = 0; i < buffers.Size(); ++i)
     {
     {
         if (!buffers[i])
         if (!buffers[i])
             continue;
             continue;
@@ -774,7 +774,7 @@ bool Graphics::SetVertexBuffers(const std::vector<VertexBuffer*>& buffers, const
     if (hash)
     if (hash)
     {
     {
         // If no previous vertex declaration for that hash, create new
         // If no previous vertex declaration for that hash, create new
-        if (vertexDeclarations_.find(hash) == vertexDeclarations_.end())
+        if (vertexDeclarations_.Find(hash) == vertexDeclarations_.End())
         {
         {
             SharedPtr<VertexDeclaration> newDeclaration(new VertexDeclaration(this, buffers, elementMasks));
             SharedPtr<VertexDeclaration> newDeclaration(new VertexDeclaration(this, buffers, elementMasks));
             if (!newDeclaration->GetDeclaration())
             if (!newDeclaration->GetDeclaration())
@@ -799,7 +799,7 @@ bool Graphics::SetVertexBuffers(const std::vector<VertexBuffer*>& buffers, const
         VertexBuffer* buffer = 0;
         VertexBuffer* buffer = 0;
         unsigned offset = 0;
         unsigned offset = 0;
         
         
-        if (i < buffers.size())
+        if (i < buffers.Size())
         {
         {
             buffer = buffers[i];
             buffer = buffers[i];
             if ((buffer) && (buffer->GetElementMask() & MASK_INSTANCEMATRIX1))
             if ((buffer) && (buffer->GetElementMask() & MASK_INSTANCEMATRIX1))
@@ -821,15 +821,15 @@ bool Graphics::SetVertexBuffers(const std::vector<VertexBuffer*>& buffers, const
     return true;
     return true;
 }
 }
 
 
-bool Graphics::SetVertexBuffers(const std::vector<SharedPtr<VertexBuffer> >& buffers, const std::vector<unsigned>&
+bool Graphics::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers, const Vector<unsigned>&
     elementMasks, unsigned instanceOffset)
     elementMasks, unsigned instanceOffset)
 {
 {
-   if (buffers.size() > MAX_VERTEX_STREAMS)
+   if (buffers.Size() > MAX_VERTEX_STREAMS)
     {
     {
         LOGERROR("Too many vertex buffers");
         LOGERROR("Too many vertex buffers");
         return false;
         return false;
     }
     }
-    if (buffers.size() != elementMasks.size())
+    if (buffers.Size() != elementMasks.Size())
     {
     {
         LOGERROR("Amount of element masks and vertex buffers does not match");
         LOGERROR("Amount of element masks and vertex buffers does not match");
         return false;
         return false;
@@ -837,7 +837,7 @@ bool Graphics::SetVertexBuffers(const std::vector<SharedPtr<VertexBuffer> >& buf
     
     
     // Build vertex declaration hash code out of the buffers & masks
     // Build vertex declaration hash code out of the buffers & masks
     unsigned long long hash = 0;
     unsigned long long hash = 0;
-    for (unsigned i = 0; i < buffers.size(); ++i)
+    for (unsigned i = 0; i < buffers.Size(); ++i)
     {
     {
         if (!buffers[i])
         if (!buffers[i])
             continue;
             continue;
@@ -848,7 +848,7 @@ bool Graphics::SetVertexBuffers(const std::vector<SharedPtr<VertexBuffer> >& buf
     if (hash)
     if (hash)
     {
     {
         // If no previous vertex declaration for that hash, create new
         // If no previous vertex declaration for that hash, create new
-        if (vertexDeclarations_.find(hash) == vertexDeclarations_.end())
+        if (vertexDeclarations_.Find(hash) == vertexDeclarations_.End())
         {
         {
             SharedPtr<VertexDeclaration> newDeclaration(new VertexDeclaration(this, buffers, elementMasks));
             SharedPtr<VertexDeclaration> newDeclaration(new VertexDeclaration(this, buffers, elementMasks));
             if (!newDeclaration->GetDeclaration())
             if (!newDeclaration->GetDeclaration())
@@ -873,7 +873,7 @@ bool Graphics::SetVertexBuffers(const std::vector<SharedPtr<VertexBuffer> >& buf
         VertexBuffer* buffer = 0;
         VertexBuffer* buffer = 0;
         unsigned offset = 0;
         unsigned offset = 0;
         
         
-        if (i < buffers.size())
+        if (i < buffers.Size())
         {
         {
             buffer = buffers[i];
             buffer = buffers[i];
             if ((buffer) && (buffer->GetElementMask() & MASK_INSTANCEMATRIX1))
             if ((buffer) && (buffer->GetElementMask() & MASK_INSTANCEMATRIX1))
@@ -1748,7 +1748,7 @@ bool Graphics::BeginImmediate(PrimitiveType type, unsigned vertexCount, unsigned
         newSize <<= 1;
         newSize <<= 1;
         
         
     // See if buffer exists for this vertex format. If not, create new
     // See if buffer exists for this vertex format. If not, create new
-    if (immediatevertexBuffer_.find(elementMask) == immediatevertexBuffer_.end())
+    if (immediatevertexBuffer_.Find(elementMask) == immediatevertexBuffer_.End())
     {
     {
         LOGDEBUG("Created immediate vertex buffer");
         LOGDEBUG("Created immediate vertex buffer");
         VertexBuffer* newBuffer = new VertexBuffer(context_);
         VertexBuffer* newBuffer = new VertexBuffer(context_);
@@ -1896,9 +1896,9 @@ unsigned Graphics::GetWindowHandle() const
     return (unsigned)impl_->window_;
     return (unsigned)impl_->window_;
 }
 }
 
 
-std::vector<IntVector2> Graphics::GetResolutions() const
+Vector<IntVector2> Graphics::GetResolutions() const
 {
 {
-    std::vector<IntVector2> ret;
+    Vector<IntVector2> ret;
     if (!impl_->interface_)
     if (!impl_->interface_)
         return ret;
         return ret;
     
     
@@ -1916,7 +1916,7 @@ std::vector<IntVector2> Graphics::GetResolutions() const
         
         
         // Check for duplicate before storing
         // Check for duplicate before storing
         bool unique = true;
         bool unique = true;
-        for (unsigned j = 0; j < ret.size(); ++j)
+        for (unsigned j = 0; j < ret.Size(); ++j)
         {
         {
             if (ret[j] == newMode)
             if (ret[j] == newMode)
             {
             {
@@ -1925,17 +1925,17 @@ std::vector<IntVector2> Graphics::GetResolutions() const
             }
             }
         }
         }
         if (unique)
         if (unique)
-            ret.push_back(newMode);
+            ret.Push(newMode);
     }
     }
     
     
     return ret;
     return ret;
 }
 }
 
 
-std::vector<int> Graphics::GetMultiSampleLevels() const
+Vector<int> Graphics::GetMultiSampleLevels() const
 {
 {
-    std::vector<int> ret;
+    Vector<int> ret;
     // No multisampling always supported
     // No multisampling always supported
-    ret.push_back(0);
+    ret.Push(0);
     
     
     if (!impl_->interface_)
     if (!impl_->interface_)
         return ret;
         return ret;
@@ -1944,7 +1944,7 @@ std::vector<int> Graphics::GetMultiSampleLevels() const
     {
     {
         if (SUCCEEDED(impl_->interface_->CheckDeviceMultiSampleType(impl_->adapter_, impl_->deviceType_, D3DFMT_R8G8B8, FALSE,
         if (SUCCEEDED(impl_->interface_->CheckDeviceMultiSampleType(impl_->adapter_, impl_->deviceType_, D3DFMT_R8G8B8, FALSE,
             (D3DMULTISAMPLE_TYPE)i, NULL)))
             (D3DMULTISAMPLE_TYPE)i, NULL)))
-            ret.push_back(i);
+            ret.Push(i);
     }
     }
     
     
     return ret;
     return ret;
@@ -1957,57 +1957,57 @@ VertexBuffer* Graphics::GetVertexBuffer(unsigned index) const
 
 
 VSParameter Graphics::GetVSParameter(const String& name)
 VSParameter Graphics::GetVSParameter(const String& name)
 {
 {
-    std::map<String, VSParameter>::iterator i = vsParameters_.find(name);
-    if (i != vsParameters_.end())
-        return i->second;
+    Map<String, VSParameter>::Iterator i = vsParameters_.Find(name);
+    if (i != vsParameters_.End())
+        return i->second_;
     else
     else
         return MAX_VS_PARAMETERS;
         return MAX_VS_PARAMETERS;
 }
 }
 
 
 PSParameter Graphics::GetPSParameter(const String& name)
 PSParameter Graphics::GetPSParameter(const String& name)
 {
 {
-    std::map<String, PSParameter>::iterator i = psParameters_.find(name);
-    if (i != psParameters_.end())
-        return i->second;
+    Map<String, PSParameter>::Iterator i = psParameters_.Find(name);
+    if (i != psParameters_.End())
+        return i->second_;
     else
     else
         return MAX_PS_PARAMETERS;
         return MAX_PS_PARAMETERS;
 }
 }
 
 
 TextureUnit Graphics::GetTextureUnit(const String& name)
 TextureUnit Graphics::GetTextureUnit(const String& name)
 {
 {
-    std::map<String, TextureUnit>::iterator i = textureUnits_.find(name);
-    if (i != textureUnits_.end())
-        return i->second;
+    Map<String, TextureUnit>::Iterator i = textureUnits_.Find(name);
+    if (i != textureUnits_.End())
+        return i->second_;
     else
     else
         return MAX_TEXTURE_UNITS;
         return MAX_TEXTURE_UNITS;
 }
 }
 
 
 const String& Graphics::GetVSParameterName(VSParameter parameter)
 const String& Graphics::GetVSParameterName(VSParameter parameter)
 {
 {
-    for (std::map<String, VSParameter>::iterator i = vsParameters_.begin(); i != vsParameters_.end(); ++i)
+    for (Map<String, VSParameter>::Iterator i = vsParameters_.Begin(); i != vsParameters_.End(); ++i)
     {
     {
-        if (i->second == parameter)
-            return i->first;
+        if (i->second_ == parameter)
+            return i->first_;
     }
     }
     return noParameter;
     return noParameter;
 }
 }
 
 
 const String& Graphics::GetPSParameterName(PSParameter parameter)
 const String& Graphics::GetPSParameterName(PSParameter parameter)
 {
 {
-    for (std::map<String, PSParameter>::iterator i = psParameters_.begin(); i != psParameters_.end(); ++i)
+    for (Map<String, PSParameter>::Iterator i = psParameters_.Begin(); i != psParameters_.End(); ++i)
     {
     {
-        if (i->second == parameter)
-            return i->first;
+        if (i->second_ == parameter)
+            return i->first_;
     }
     }
     return noParameter;
     return noParameter;
 }
 }
 
 
 const String& Graphics::GetTextureUnitName(TextureUnit unit)
 const String& Graphics::GetTextureUnitName(TextureUnit unit)
 {
 {
-    for (std::map<String, TextureUnit>::iterator i = textureUnits_.begin(); i != textureUnits_.end(); ++i)
+    for (Map<String, TextureUnit>::Iterator i = textureUnits_.Begin(); i != textureUnits_.End(); ++i)
     {
     {
-        if (i->second == unit)
-            return i->first;
+        if (i->second_ == unit)
+            return i->first_;
     }
     }
     return noParameter;
     return noParameter;
 }
 }
@@ -2047,16 +2047,16 @@ IntVector2 Graphics::GetRenderTargetDimensions() const
 
 
 void Graphics::AddGPUObject(GPUObject* object)
 void Graphics::AddGPUObject(GPUObject* object)
 {
 {
-    gpuObjects_.push_back(object);
+    gpuObjects_.Push(object);
 }
 }
 
 
 void Graphics::RemoveGPUObject(GPUObject* object)
 void Graphics::RemoveGPUObject(GPUObject* object)
 {
 {
-    for (std::vector<GPUObject*>::iterator i = gpuObjects_.begin(); i != gpuObjects_.end(); ++i)
+    for (Vector<GPUObject*>::Iterator i = gpuObjects_.Begin(); i != gpuObjects_.End(); ++i)
     {
     {
         if ((*i) == object)
         if ((*i) == object)
         {
         {
-            gpuObjects_.erase(i);
+            gpuObjects_.Erase(i);
             return;
             return;
         }
         }
     }
     }
@@ -2319,7 +2319,7 @@ void Graphics::OnDeviceLost()
         impl_->defaultDepthStencilSurface_ = 0;
         impl_->defaultDepthStencilSurface_ = 0;
     }
     }
     
     
-    for (unsigned i = 0; i < gpuObjects_.size(); ++i)
+    for (unsigned i = 0; i < gpuObjects_.Size(); ++i)
         gpuObjects_[i]->OnDeviceLost();
         gpuObjects_[i]->OnDeviceLost();
 }
 }
 
 
@@ -2333,7 +2333,7 @@ void Graphics::OnDeviceReset()
     // Create deferred rendering buffers now
     // Create deferred rendering buffers now
     CreateRenderTargets();
     CreateRenderTargets();
     
     
-    for (unsigned i = 0; i < gpuObjects_.size(); ++i)
+    for (unsigned i = 0; i < gpuObjects_.Size(); ++i)
         gpuObjects_[i]->OnDeviceReset();
         gpuObjects_[i]->OnDeviceReset();
     
     
     // Get default surfaces
     // Get default surfaces

+ 11 - 11
Engine/Graphics/Graphics.h

@@ -94,9 +94,9 @@ public:
     /// Set vertex buffer
     /// Set vertex buffer
     void SetVertexBuffer(VertexBuffer* buffer);
     void SetVertexBuffer(VertexBuffer* buffer);
     /// Set multiple vertex buffers
     /// Set multiple vertex buffers
-    bool SetVertexBuffers(const std::vector<VertexBuffer*>& buffers, const std::vector<unsigned>& elementMasks, unsigned instanceOffset = 0);
+    bool SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const Vector<unsigned>& elementMasks, unsigned instanceOffset = 0);
     /// Set multiple vertex buffers
     /// Set multiple vertex buffers
-    bool SetVertexBuffers(const std::vector<SharedPtr<VertexBuffer> >& buffers, const std::vector<unsigned>& elementMasks, unsigned instanceOffset = 0);
+    bool SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers, const Vector<unsigned>& elementMasks, unsigned instanceOffset = 0);
     /// Set index buffer
     /// Set index buffer
     void SetIndexBuffer(IndexBuffer* buffer);
     void SetIndexBuffer(IndexBuffer* buffer);
     /// Set shaders
     /// Set shaders
@@ -269,9 +269,9 @@ public:
     /// Return whether stream offset is supported
     /// Return whether stream offset is supported
     bool GetStreamOffsetSupport() const { return streamOffsetSupport_; }
     bool GetStreamOffsetSupport() const { return streamOffsetSupport_; }
     /// Return supported fullscreen resolutions
     /// Return supported fullscreen resolutions
-    std::vector<IntVector2> GetResolutions() const;
+    Vector<IntVector2> GetResolutions() const;
     /// Return supported multisampling levels
     /// Return supported multisampling levels
-    std::vector<int> GetMultiSampleLevels() const;
+    Vector<int> GetMultiSampleLevels() const;
     /// Return vertex buffer by index
     /// Return vertex buffer by index
     VertexBuffer* GetVertexBuffer(unsigned index) const;
     VertexBuffer* GetVertexBuffer(unsigned index) const;
     /// Return index buffer
     /// Return index buffer
@@ -453,13 +453,13 @@ private:
     /// Immediate rendering data pointer
     /// Immediate rendering data pointer
     unsigned char* immediateDataPtr_;
     unsigned char* immediateDataPtr_;
     /// GPU objects
     /// GPU objects
-    std::vector<GPUObject*> gpuObjects_;
+    Vector<GPUObject*> gpuObjects_;
     /// Vertex declarations
     /// Vertex declarations
-    std::map<unsigned long long, SharedPtr<VertexDeclaration> > vertexDeclarations_;
+    Map<unsigned long long, SharedPtr<VertexDeclaration> > vertexDeclarations_;
     /// Immediate rendering vertex buffers by vertex declaration
     /// Immediate rendering vertex buffers by vertex declaration
-    std::map<unsigned, SharedPtr<VertexBuffer> > immediatevertexBuffer_;
+    Map<unsigned, SharedPtr<VertexBuffer> > immediatevertexBuffer_;
     /// Immediate rendering vertex buffer start positions
     /// Immediate rendering vertex buffer start positions
-    std::map<unsigned, unsigned> immediateVertexBufferPos_;
+    Map<unsigned, unsigned> immediateVertexBufferPos_;
     /// Deferred rendering diffuse buffer
     /// Deferred rendering diffuse buffer
     SharedPtr<Texture2D> diffBuffer_;
     SharedPtr<Texture2D> diffBuffer_;
     /// Deferred rendering normal buffer
     /// Deferred rendering normal buffer
@@ -489,9 +489,9 @@ private:
     /// Pixel shader in use
     /// Pixel shader in use
     PixelShader* pixelShader_;
     PixelShader* pixelShader_;
     /// Vertex shader parameter mappings
     /// Vertex shader parameter mappings
-    std::map<String, VSParameter> vsParameters_;
+    Map<String, VSParameter> vsParameters_;
     /// Pixel shader parameter mappings
     /// Pixel shader parameter mappings
-    std::map<String, PSParameter> psParameters_;
+    Map<String, PSParameter> psParameters_;
     /// Vertex shader constant register mappings
     /// Vertex shader constant register mappings
     unsigned vsRegisters_[MAX_VS_PARAMETERS];
     unsigned vsRegisters_[MAX_VS_PARAMETERS];
     /// Pixel shader constant register mappings
     /// Pixel shader constant register mappings
@@ -505,7 +505,7 @@ private:
     /// "View texture" to prevent sampling the destination render target
     /// "View texture" to prevent sampling the destination render target
     Texture* viewTexture_;
     Texture* viewTexture_;
     /// Texture unit mappings
     /// Texture unit mappings
-    std::map<String, TextureUnit> textureUnits_;
+    Map<String, TextureUnit> textureUnits_;
     /// Render targets in use
     /// Render targets in use
     RenderSurface* renderTarget_[MAX_RENDERTARGETS];
     RenderSurface* renderTarget_[MAX_RENDERTARGETS];
     /// Depth stencil buffer in use
     /// Depth stencil buffer in use

+ 25 - 25
Engine/Graphics/Material.cpp

@@ -84,7 +84,7 @@ Material::Material(Context* context) :
     occlusion_(true)
     occlusion_(true)
 {
 {
     SetNumTechniques(1);
     SetNumTechniques(1);
-    textures_.resize(MAX_MATERIAL_TEXTURE_UNITS);
+    textures_.Resize(MAX_MATERIAL_TEXTURE_UNITS);
     
     
     // Setup often used default parameters
     // Setup often used default parameters
     vsParameters_[VSP_UOFFSET] = Vector4(1.0f, 0.0f, 0.0f, 0.0f);
     vsParameters_[VSP_UOFFSET] = Vector4(1.0f, 0.0f, 0.0f, 0.0f);
@@ -119,7 +119,7 @@ bool Material::Load(Deserializer& source)
     XMLElement rootElem = xml->GetRootElement();
     XMLElement rootElem = xml->GetRootElement();
     
     
     XMLElement techniqueElem = rootElem.GetChildElement("technique");
     XMLElement techniqueElem = rootElem.GetChildElement("technique");
-    techniques_.clear();
+    techniques_.Clear();
     while (techniqueElem)
     while (techniqueElem)
     {
     {
         Technique* technique = cache->GetResource<Technique>(techniqueElem.GetString("name"));
         Technique* technique = cache->GetResource<Technique>(techniqueElem.GetString("name"));
@@ -131,7 +131,7 @@ bool Material::Load(Deserializer& source)
                 newTechnique.qualityLevel_ = techniqueElem.GetInt("quality");
                 newTechnique.qualityLevel_ = techniqueElem.GetInt("quality");
             if (techniqueElem.HasAttribute("loddistance"))
             if (techniqueElem.HasAttribute("loddistance"))
                 newTechnique.lodDistance_ = techniqueElem.GetFloat("loddistance");
                 newTechnique.lodDistance_ = techniqueElem.GetFloat("loddistance");
-            techniques_.push_back(newTechnique);
+            techniques_.Push(newTechnique);
         }
         }
         techniqueElem = techniqueElem.GetNextElement("technique");
         techniqueElem = techniqueElem.GetNextElement("technique");
     }
     }
@@ -199,10 +199,10 @@ bool Material::Load(Deserializer& source)
     // Calculate memory use
     // Calculate memory use
     unsigned memoryUse = 0;
     unsigned memoryUse = 0;
     memoryUse += sizeof(Material);
     memoryUse += sizeof(Material);
-    memoryUse += techniques_.size() * sizeof(TechniqueEntry);
-    memoryUse += textures_.size() * sizeof(SharedPtr<Texture>);
-    memoryUse += vsParameters_.size() * (sizeof(VSParameter) + sizeof(Vector4));
-    memoryUse += psParameters_.size() * (sizeof(PSParameter) + sizeof(Vector4));
+    memoryUse += techniques_.Size() * sizeof(TechniqueEntry);
+    memoryUse += textures_.Size() * sizeof(SharedPtr<Texture>);
+    memoryUse += vsParameters_.Size() * (sizeof(VSParameter) + sizeof(Vector4));
+    memoryUse += psParameters_.Size() * (sizeof(PSParameter) + sizeof(Vector4));
     
     
     SetMemoryUse(memoryUse);
     SetMemoryUse(memoryUse);
     Update();
     Update();
@@ -219,7 +219,7 @@ bool Material::Save(Serializer& dest)
     XMLElement materialElem = xml->CreateRootElement("material");
     XMLElement materialElem = xml->CreateRootElement("material");
     
     
     // Write techniques
     // Write techniques
-    for (unsigned i = 0; i < techniques_.size(); ++i)
+    for (unsigned i = 0; i < techniques_.Size(); ++i)
     {
     {
         TechniqueEntry& entry = techniques_[i];
         TechniqueEntry& entry = techniques_[i];
         if (!entry.technique_)
         if (!entry.technique_)
@@ -244,17 +244,17 @@ bool Material::Save(Serializer& dest)
     }
     }
     
     
     // Write shader parameters
     // Write shader parameters
-    for (std::map<VSParameter, Vector4>::const_iterator j = vsParameters_.begin(); j != vsParameters_.end(); ++j)
+    for (Map<VSParameter, Vector4>::ConstIterator j = vsParameters_.Begin(); j != vsParameters_.End(); ++j)
     {
     {
         XMLElement parameterElem = materialElem.CreateChildElement("parameter");
         XMLElement parameterElem = materialElem.CreateChildElement("parameter");
-        parameterElem.SetString("name", graphics->GetVSParameterName(j->first));
-        parameterElem.SetVector4("value", j->second);
+        parameterElem.SetString("name", graphics->GetVSParameterName(j->first_));
+        parameterElem.SetVector4("value", j->second_);
     }
     }
-    for (std::map<PSParameter, Vector4>::const_iterator j = psParameters_.begin(); j != psParameters_.end(); ++j)
+    for (Map<PSParameter, Vector4>::ConstIterator j = psParameters_.Begin(); j != psParameters_.End(); ++j)
     {
     {
         XMLElement parameterElem = materialElem.CreateChildElement("parameter");
         XMLElement parameterElem = materialElem.CreateChildElement("parameter");
-        parameterElem.SetString("name", graphics->GetPSParameterName(j->first));
-        parameterElem.SetVector4("value", j->second);
+        parameterElem.SetString("name", graphics->GetPSParameterName(j->first_));
+        parameterElem.SetVector4("value", j->second_);
     }
     }
     
     
     return xml->Save(dest);
     return xml->Save(dest);
@@ -265,12 +265,12 @@ void Material::SetNumTechniques(unsigned num)
     if (!num)
     if (!num)
         return;
         return;
     
     
-    techniques_.resize(num);
+    techniques_.Resize(num);
 }
 }
 
 
 void Material::SetTechnique(unsigned index, Technique* technique, unsigned qualityLevel, float lodDistance)
 void Material::SetTechnique(unsigned index, Technique* technique, unsigned qualityLevel, float lodDistance)
 {
 {
-    if (index >= techniques_.size())
+    if (index >= techniques_.Size())
         return;
         return;
     
     
     techniques_[index] = TechniqueEntry(technique, qualityLevel, lodDistance);
     techniques_[index] = TechniqueEntry(technique, qualityLevel, lodDistance);
@@ -347,7 +347,7 @@ void Material::SetShadowCullMode(CullMode mode)
 
 
 void Material::ReleaseShaders()
 void Material::ReleaseShaders()
 {
 {
-    for (unsigned i = 0; i < techniques_.size(); ++i)
+    for (unsigned i = 0; i < techniques_.Size(); ++i)
     {
     {
         Technique* technique = techniques_[i].technique_;
         Technique* technique = techniques_[i].technique_;
         if (technique)
         if (technique)
@@ -379,23 +379,23 @@ void Material::MarkForAuxView(unsigned frameNumber)
 const TechniqueEntry& Material::GetTechniqueEntry(unsigned index) const
 const TechniqueEntry& Material::GetTechniqueEntry(unsigned index) const
 {
 {
     TechniqueEntry noEntry;
     TechniqueEntry noEntry;
-    return index < techniques_.size() ? techniques_[index] : noEntry;
+    return index < techniques_.Size() ? techniques_[index] : noEntry;
 }
 }
 
 
 Technique* Material::GetTechnique(unsigned index) const
 Technique* Material::GetTechnique(unsigned index) const
 {
 {
-    return index < techniques_.size() ? techniques_[index].technique_ : (Technique*)0;
+    return index < techniques_.Size() ? techniques_[index].technique_ : (Technique*)0;
 }
 }
 
 
 Pass* Material::GetPass(unsigned index, PassType pass) const
 Pass* Material::GetPass(unsigned index, PassType pass) const
 {
 {
-    Technique* technique = index < techniques_.size() ? techniques_[index].technique_ : (Technique*)0;
+    Technique* technique = index < techniques_.Size() ? techniques_[index].technique_ : (Technique*)0;
     return technique ? technique->GetPass(pass) : 0;
     return technique ? technique->GetPass(pass) : 0;
 }
 }
 
 
 Texture* Material::GetTexture(TextureUnit unit) const
 Texture* Material::GetTexture(TextureUnit unit) const
 {
 {
-    return (unsigned)unit < textures_.size() ? textures_[unit] : (Texture*)0;
+    return (unsigned)unit < textures_.Size() ? textures_[unit] : (Texture*)0;
 }
 }
 
 
 const String& Material::GetTextureUnitName(TextureUnit unit)
 const String& Material::GetTextureUnitName(TextureUnit unit)
@@ -407,17 +407,17 @@ void Material::Update()
 {
 {
     // Determine occlusion by checking the first pass of each technique
     // Determine occlusion by checking the first pass of each technique
     occlusion_ = false;
     occlusion_ = false;
-    for (unsigned i = 0; i < techniques_.size(); ++i)
+    for (unsigned i = 0; i < techniques_.Size(); ++i)
     {
     {
         Technique* technique = techniques_[i].technique_;
         Technique* technique = techniques_[i].technique_;
         if (!technique)
         if (!technique)
             continue;
             continue;
         
         
-        const std::map<PassType, Pass>& passes = technique->GetPasses();
-        if (!passes.empty())
+        const Map<PassType, Pass>& passes = technique->GetPasses();
+        if (!passes.Empty())
         {
         {
             // If pass writes depth, enable occlusion
             // If pass writes depth, enable occlusion
-            const Pass& pass = passes.begin()->second;
+            const Pass& pass = passes.Begin()->second_;
             if (pass.GetDepthWrite())
             if (pass.GetDepthWrite())
             {
             {
                 occlusion_ = true;
                 occlusion_ = true;

+ 9 - 9
Engine/Graphics/Material.h

@@ -97,9 +97,9 @@ public:
     void MarkForAuxView(unsigned frameNumber);
     void MarkForAuxView(unsigned frameNumber);
     
     
     /// Return number of techniques
     /// Return number of techniques
-    unsigned GetNumTechniques() const { return techniques_.size(); }
+    unsigned GetNumTechniques() const { return techniques_.Size(); }
     /// Return all techniques
     /// Return all techniques
-    const std::vector<TechniqueEntry>& GetTechniques() const { return techniques_; }
+    const Vector<TechniqueEntry>& GetTechniques() const { return techniques_; }
     /// Return technique entry by index
     /// Return technique entry by index
     const TechniqueEntry& GetTechniqueEntry(unsigned index) const;
     const TechniqueEntry& GetTechniqueEntry(unsigned index) const;
     /// Return technique by index
     /// Return technique by index
@@ -107,13 +107,13 @@ public:
     /// Return pass by technique index and pass type
     /// Return pass by technique index and pass type
     Pass* GetPass(unsigned index, PassType pass) const;
     Pass* GetPass(unsigned index, PassType pass) const;
     /// Return all textures
     /// Return all textures
-    const std::vector<SharedPtr<Texture> >& GetTextures() const { return textures_; }
+    const Vector<SharedPtr<Texture> >& GetTextures() const { return textures_; }
     /// Return texture by unit
     /// Return texture by unit
     Texture* GetTexture(TextureUnit unit) const;
     Texture* GetTexture(TextureUnit unit) const;
     /// Return all vertex shader parameters
     /// Return all vertex shader parameters
-    const std::map<VSParameter, Vector4>& GetVertexShaderParameters() const { return vsParameters_; }
+    const Map<VSParameter, Vector4>& GetVertexShaderParameters() const { return vsParameters_; }
     /// Return all pixel shader parameters
     /// Return all pixel shader parameters
-    const std::map<PSParameter, Vector4>& GetPixelShaderParameters() const { return psParameters_; }
+    const Map<PSParameter, Vector4>& GetPixelShaderParameters() const { return psParameters_; }
     /// Return normal culling mode
     /// Return normal culling mode
     CullMode GetCullMode() const { return cullMode_; }
     CullMode GetCullMode() const { return cullMode_; }
     /// Return culling mode for shadows
     /// Return culling mode for shadows
@@ -131,13 +131,13 @@ private:
     void Update();
     void Update();
     
     
     /// Techniques
     /// Techniques
-    std::vector<TechniqueEntry> techniques_;
+    Vector<TechniqueEntry> techniques_;
     /// Textures
     /// Textures
-    std::vector<SharedPtr<Texture> > textures_;
+    Vector<SharedPtr<Texture> > textures_;
     /// Vertex shader parameters
     /// Vertex shader parameters
-    std::map<VSParameter, Vector4> vsParameters_;
+    Map<VSParameter, Vector4> vsParameters_;
     /// Pixel shader parameters
     /// Pixel shader parameters
-    std::map<PSParameter, Vector4> psParameters_;
+    Map<PSParameter, Vector4> psParameters_;
     /// Normal culling mode
     /// Normal culling mode
     CullMode cullMode_;
     CullMode cullMode_;
     /// Culling mode for shadow rendering
     /// Culling mode for shadow rendering

+ 62 - 62
Engine/Graphics/Model.cpp

@@ -37,26 +37,26 @@
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
-unsigned StoreOrLookupVertexBuffer(VertexBuffer* buffer, std::vector<VertexBuffer*>& dest)
+unsigned StoreOrLookupVertexBuffer(VertexBuffer* buffer, Vector<VertexBuffer*>& dest)
 {
 {
-    for (unsigned i = 0; i < dest.size(); ++i)
+    for (unsigned i = 0; i < dest.Size(); ++i)
     {
     {
         if (dest[i] == buffer)
         if (dest[i] == buffer)
             return i;
             return i;
     }
     }
-    dest.push_back(buffer);
-    return dest.size() - 1;
+    dest.Push(buffer);
+    return dest.Size() - 1;
 }
 }
 
 
-unsigned StoreOrLookupIndexBuffer(IndexBuffer* buffer, std::vector<IndexBuffer*>& dest)
+unsigned StoreOrLookupIndexBuffer(IndexBuffer* buffer, Vector<IndexBuffer*>& dest)
 {
 {
-    for (unsigned i = 0; i < dest.size(); ++i)
+    for (unsigned i = 0; i < dest.Size(); ++i)
     {
     {
         if (dest[i] == buffer)
         if (dest[i] == buffer)
             return i;
             return i;
     }
     }
-    dest.push_back(buffer);
-    return dest.size() - 1;
+    dest.Push(buffer);
+    return dest.Size() - 1;
 }
 }
 
 
 OBJECTTYPESTATIC(Model);
 OBJECTTYPESTATIC(Model);
@@ -86,11 +86,11 @@ bool Model::Load(Deserializer& source)
         return false;
         return false;
     }
     }
     
     
-    geometries_.clear();
-    geometryBoneMappings_.clear();
-    morphs_.clear();
-    vertexBuffer_.clear();
-    indexBuffers_.clear();
+    geometries_.Clear();
+    geometryBoneMappings_.Clear();
+    morphs_.Clear();
+    vertexBuffer_.Clear();
+    indexBuffers_.Clear();
     
     
     SetMemoryUse(source.GetSize());
     SetMemoryUse(source.GetSize());
     
     
@@ -120,7 +120,7 @@ bool Model::Load(Deserializer& source)
             buffer->SetMorphRangeResetData(morphResetData);
             buffer->SetMorphRangeResetData(morphResetData);
         }
         }
         
         
-        vertexBuffer_.push_back(buffer);
+        vertexBuffer_.Push(buffer);
     }
     }
     
     
     // Read index buffers
     // Read index buffers
@@ -136,7 +136,7 @@ bool Model::Load(Deserializer& source)
         source.Read(data.GetPtr(), indexCount * indexSize);
         source.Read(data.GetPtr(), indexCount * indexSize);
         buffer->SetData(data.GetPtr());
         buffer->SetData(data.GetPtr());
         
         
-        indexBuffers_.push_back(buffer);
+        indexBuffers_.Push(buffer);
     }
     }
     
     
     // Read geometries
     // Read geometries
@@ -145,13 +145,13 @@ bool Model::Load(Deserializer& source)
     {
     {
         // Read bone mappings
         // Read bone mappings
         unsigned boneMappingCount = source.ReadUInt();
         unsigned boneMappingCount = source.ReadUInt();
-        std::vector<unsigned> boneMapping;
+        Vector<unsigned> boneMapping;
         for (unsigned j = 0; j < boneMappingCount; ++j)
         for (unsigned j = 0; j < boneMappingCount; ++j)
-            boneMapping.push_back(source.ReadUInt());
-        geometryBoneMappings_.push_back(boneMapping);
+            boneMapping.Push(source.ReadUInt());
+        geometryBoneMappings_.Push(boneMapping);
         
         
         unsigned nulodLevels_ = source.ReadUInt();
         unsigned nulodLevels_ = source.ReadUInt();
-        std::vector<SharedPtr<Geometry> > geometryLodLevels;
+        Vector<SharedPtr<Geometry> > geometryLodLevels;
         
         
         for (unsigned j = 0; j < nulodLevels_; ++j)
         for (unsigned j = 0; j < nulodLevels_; ++j)
         {
         {
@@ -163,12 +163,12 @@ bool Model::Load(Deserializer& source)
             unsigned indexStart = source.ReadUInt();
             unsigned indexStart = source.ReadUInt();
             unsigned indexCount = source.ReadUInt();
             unsigned indexCount = source.ReadUInt();
             
             
-            if (vertexBufferRef >= vertexBuffer_.size())
+            if (vertexBufferRef >= vertexBuffer_.Size())
             {
             {
                 LOGERROR("Vertex buffer index out of bounds");
                 LOGERROR("Vertex buffer index out of bounds");
                 return false;
                 return false;
             }
             }
-            if (indexBufferRef >= indexBuffers_.size())
+            if (indexBufferRef >= indexBuffers_.Size())
             {
             {
                 LOGERROR("Index buffer index out of bounds");
                 LOGERROR("Index buffer index out of bounds");
                 return false;
                 return false;
@@ -181,10 +181,10 @@ bool Model::Load(Deserializer& source)
             geometry->SetDrawRange(type, indexStart, indexCount);
             geometry->SetDrawRange(type, indexStart, indexCount);
             geometry->SetLodDistance(distance);
             geometry->SetLodDistance(distance);
             
             
-            geometryLodLevels.push_back(geometry);
+            geometryLodLevels.Push(geometry);
         }
         }
         
         
-        geometries_.push_back(geometryLodLevels);
+        geometries_.Push(geometryLodLevels);
     }
     }
     
     
     // Read morphs
     // Read morphs
@@ -222,7 +222,7 @@ bool Model::Load(Deserializer& source)
             newMorph.buffers_[bufferIndex] = newBuffer;
             newMorph.buffers_[bufferIndex] = newBuffer;
         }
         }
         
         
-        morphs_.push_back(newMorph);
+        morphs_.Push(newMorph);
     }
     }
     
     
     // Read skeleton
     // Read skeleton
@@ -237,12 +237,12 @@ bool Model::Load(Deserializer& source)
 bool Model::Save(Serializer& dest)
 bool Model::Save(Serializer& dest)
 {
 {
     // Build lists of vertex and index buffers used by the geometries
     // Build lists of vertex and index buffers used by the geometries
-    std::vector<VertexBuffer*> vertexBuffers;
-    std::vector<IndexBuffer*> indexBuffers;
+    Vector<VertexBuffer*> vertexBuffers;
+    Vector<IndexBuffer*> indexBuffers;
     
     
-    for (unsigned i = 0; i < geometries_.size(); ++i)
+    for (unsigned i = 0; i < geometries_.Size(); ++i)
     {
     {
-        for (unsigned j = 0; j < geometries_[i].size(); ++j)
+        for (unsigned j = 0; j < geometries_[i].Size(); ++j)
         {
         {
             StoreOrLookupVertexBuffer(geometries_[i][j]->GetVertexBuffer(0), vertexBuffers);
             StoreOrLookupVertexBuffer(geometries_[i][j]->GetVertexBuffer(0), vertexBuffers);
             StoreOrLookupIndexBuffer(geometries_[i][j]->GetIndexBuffer(), indexBuffers);
             StoreOrLookupIndexBuffer(geometries_[i][j]->GetIndexBuffer(), indexBuffers);
@@ -254,8 +254,8 @@ bool Model::Save(Serializer& dest)
         return false;
         return false;
     
     
     // Write vertex buffers
     // Write vertex buffers
-    dest.WriteUInt(vertexBuffers.size());
-    for (unsigned i = 0; i < vertexBuffers.size(); ++i)
+    dest.WriteUInt(vertexBuffers.Size());
+    for (unsigned i = 0; i < vertexBuffers.Size(); ++i)
     {
     {
         VertexBuffer* buffer = vertexBuffers[i];
         VertexBuffer* buffer = vertexBuffers[i];
         dest.WriteUInt(buffer->GetVertexCount());
         dest.WriteUInt(buffer->GetVertexCount());
@@ -269,8 +269,8 @@ bool Model::Save(Serializer& dest)
         buffer->Unlock();
         buffer->Unlock();
     }
     }
     // Write index buffers
     // Write index buffers
-    dest.WriteUInt(indexBuffers.size());
-    for (unsigned i = 0; i < indexBuffers.size(); ++i)
+    dest.WriteUInt(indexBuffers.Size());
+    for (unsigned i = 0; i < indexBuffers.Size(); ++i)
     {
     {
         IndexBuffer* buffer = indexBuffers[i];
         IndexBuffer* buffer = indexBuffers[i];
         dest.WriteUInt(buffer->GetIndexCount());
         dest.WriteUInt(buffer->GetIndexCount());
@@ -282,17 +282,17 @@ bool Model::Save(Serializer& dest)
         buffer->Unlock();
         buffer->Unlock();
     }
     }
     // Write geometries
     // Write geometries
-    dest.WriteUInt(geometries_.size());
-    for (unsigned i = 0; i < geometries_.size(); ++i)
+    dest.WriteUInt(geometries_.Size());
+    for (unsigned i = 0; i < geometries_.Size(); ++i)
     {
     {
         // Write bone mappings
         // Write bone mappings
-        dest.WriteUInt(geometryBoneMappings_[i].size());
-        for (unsigned j = 0; j < geometryBoneMappings_[i].size(); ++j)
+        dest.WriteUInt(geometryBoneMappings_[i].Size());
+        for (unsigned j = 0; j < geometryBoneMappings_[i].Size(); ++j)
             dest.WriteUInt(geometryBoneMappings_[i][j]);
             dest.WriteUInt(geometryBoneMappings_[i][j]);
         
         
         // Write the LOD levels
         // Write the LOD levels
-        dest.WriteUInt(geometries_[i].size());
-        for (unsigned j = 0; j < geometries_[i].size(); ++j)
+        dest.WriteUInt(geometries_[i].Size());
+        for (unsigned j = 0; j < geometries_[i].Size(); ++j)
         {
         {
             Geometry* geometry = geometries_[i][j];
             Geometry* geometry = geometries_[i][j];
             dest.WriteFloat(geometry->GetLodDistance());
             dest.WriteFloat(geometry->GetLodDistance());
@@ -305,31 +305,31 @@ bool Model::Save(Serializer& dest)
     }
     }
     
     
     // Write morphs
     // Write morphs
-    dest.WriteUInt(morphs_.size());
-    for (unsigned i = 0; i < morphs_.size(); ++i)
+    dest.WriteUInt(morphs_.Size());
+    for (unsigned i = 0; i < morphs_.Size(); ++i)
     {
     {
         dest.WriteString(morphs_[i].name_);
         dest.WriteString(morphs_[i].name_);
-        dest.WriteUInt(morphs_[i].buffers_.size());
+        dest.WriteUInt(morphs_[i].buffers_.Size());
         
         
         // Write morph vertex buffers
         // Write morph vertex buffers
-        for (std::map<unsigned int, VertexBufferMorph>::const_iterator j = morphs_[i].buffers_.begin();
-            j != morphs_[i].buffers_.end(); ++j)
+        for (Map<unsigned int, VertexBufferMorph>::ConstIterator j = morphs_[i].buffers_.Begin();
+            j != morphs_[i].buffers_.End(); ++j)
         {
         {
-            dest.WriteUInt(j->first);
-            dest.WriteUInt(j->second.elementMask_);
-            dest.WriteUInt(j->second.vertexCount_);
+            dest.WriteUInt(j->first_);
+            dest.WriteUInt(j->second_.elementMask_);
+            dest.WriteUInt(j->second_.vertexCount_);
             
             
             // Base size: size of each vertex index
             // Base size: size of each vertex index
             unsigned vertexSize = sizeof(unsigned);
             unsigned vertexSize = sizeof(unsigned);
             // Add size of individual elements
             // Add size of individual elements
-            if (j->second.elementMask_ & MASK_POSITION)
+            if (j->second_.elementMask_ & MASK_POSITION)
                 vertexSize += sizeof(Vector3);
                 vertexSize += sizeof(Vector3);
-            if (j->second.elementMask_ & MASK_NORMAL)
+            if (j->second_.elementMask_ & MASK_NORMAL)
                 vertexSize += sizeof(Vector3);
                 vertexSize += sizeof(Vector3);
-            if (j->second.elementMask_ & MASK_TANGENT)
+            if (j->second_.elementMask_ & MASK_TANGENT)
                 vertexSize += sizeof(Vector3);
                 vertexSize += sizeof(Vector3);
             
             
-            dest.Write(j->second.morphData_.GetPtr(), vertexSize * j->second.vertexCount_);
+            dest.Write(j->second_.morphData_.GetPtr(), vertexSize * j->second_.vertexCount_);
         }
         }
     }
     }
     
     
@@ -349,13 +349,13 @@ void Model::SetBoundingBox(const BoundingBox& box)
 
 
 void Model::SetNumGeometries(unsigned num)
 void Model::SetNumGeometries(unsigned num)
 {
 {
-    geometries_.resize(num);
-    geometryBoneMappings_.resize(num);
+    geometries_.Resize(num);
+    geometryBoneMappings_.Resize(num);
 }
 }
 
 
 bool Model::SetNumGeometryLodLevels(unsigned index, unsigned num)
 bool Model::SetNumGeometryLodLevels(unsigned index, unsigned num)
 {
 {
-    if (index >= geometries_.size())
+    if (index >= geometries_.Size())
     {
     {
         LOGERROR("Geometry index out of bounds");
         LOGERROR("Geometry index out of bounds");
         return false;
         return false;
@@ -366,18 +366,18 @@ bool Model::SetNumGeometryLodLevels(unsigned index, unsigned num)
         return false;
         return false;
     }
     }
     
     
-    geometries_[index].resize(num);
+    geometries_[index].Resize(num);
     return true;
     return true;
 }
 }
 
 
 bool Model::SetGeometry(unsigned index, unsigned lodLevel, Geometry* geometry)
 bool Model::SetGeometry(unsigned index, unsigned lodLevel, Geometry* geometry)
 {
 {
-    if (index >= geometries_.size())
+    if (index >= geometries_.Size())
     {
     {
         LOGERROR("Geometry index out of bounds");
         LOGERROR("Geometry index out of bounds");
         return false;
         return false;
     }
     }
-    if (lodLevel >= geometries_[index].size())
+    if (lodLevel >= geometries_[index].Size())
     {
     {
         LOGERROR("LOD level index out of bounds");
         LOGERROR("LOD level index out of bounds");
         return false;
         return false;
@@ -392,24 +392,24 @@ void Model::SetSkeleton(const Skeleton& skeleton)
     skeleton_ = skeleton;
     skeleton_ = skeleton;
 }
 }
 
 
-void Model::SetGeometryBoneMappings(const std::vector<std::vector<unsigned> >& geometryBoneMappings)
+void Model::SetGeometryBoneMappings(const Vector<Vector<unsigned> >& geometryBoneMappings)
 {
 {
     geometryBoneMappings_ = geometryBoneMappings;
     geometryBoneMappings_ = geometryBoneMappings;
 }
 }
 
 
-void Model::SetMorphs(const std::vector<ModelMorph>& morphs)
+void Model::SetMorphs(const Vector<ModelMorph>& morphs)
 {
 {
     morphs_ = morphs;
     morphs_ = morphs;
 }
 }
 
 
 unsigned Model::GetNumGeometryLodLevels(unsigned index) const
 unsigned Model::GetNumGeometryLodLevels(unsigned index) const
 {
 {
-    return index < geometries_.size() ? geometries_[index].size() : 0;
+    return index < geometries_.Size() ? geometries_[index].Size() : 0;
 }
 }
 
 
 Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
 Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
 {
 {
-    if ((index >= geometries_.size()) || (lodLevel >= geometries_[index].size()))
+    if ((index >= geometries_.Size()) || (lodLevel >= geometries_[index].Size()))
         return 0;
         return 0;
     
     
     return geometries_[index][lodLevel];
     return geometries_[index][lodLevel];
@@ -417,7 +417,7 @@ Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
 
 
 const ModelMorph* Model::GetMorph(unsigned index) const
 const ModelMorph* Model::GetMorph(unsigned index) const
 {
 {
-    return index < morphs_.size() ? &morphs_[index] : 0;
+    return index < morphs_.Size() ? &morphs_[index] : 0;
 }
 }
 
 
 const ModelMorph* Model::GetMorph(const String& name) const
 const ModelMorph* Model::GetMorph(const String& name) const
@@ -427,7 +427,7 @@ const ModelMorph* Model::GetMorph(const String& name) const
 
 
 const ModelMorph* Model::GetMorph(StringHash nameHash) const
 const ModelMorph* Model::GetMorph(StringHash nameHash) const
 {
 {
-    for (std::vector<ModelMorph>::const_iterator i = morphs_.begin(); i != morphs_.end(); ++i)
+    for (Vector<ModelMorph>::ConstIterator i = morphs_.Begin(); i != morphs_.End(); ++i)
     {
     {
         if (i->nameHash_ == nameHash)
         if (i->nameHash_ == nameHash)
             return &(*i);
             return &(*i);

+ 15 - 15
Engine/Graphics/Model.h

@@ -55,7 +55,7 @@ struct ModelMorph
     /// Current morph weight
     /// Current morph weight
     float weight_;
     float weight_;
     /// Morph data per vertex buffer
     /// Morph data per vertex buffer
-    std::map<unsigned, VertexBufferMorph> buffers_;
+    Map<unsigned, VertexBufferMorph> buffers_;
 };
 };
 
 
 /// Model resource
 /// Model resource
@@ -87,32 +87,32 @@ public:
     /// Set skeleton
     /// Set skeleton
     void SetSkeleton(const Skeleton& skeleton);
     void SetSkeleton(const Skeleton& skeleton);
     /// Set bone mappings when model has more bones than the skinning shader can handle
     /// Set bone mappings when model has more bones than the skinning shader can handle
-    void SetGeometryBoneMappings(const std::vector<std::vector<unsigned> >& mappings);
+    void SetGeometryBoneMappings(const Vector<Vector<unsigned> >& mappings);
     /// Set vertex morphs
     /// Set vertex morphs
-    void SetMorphs(const std::vector<ModelMorph>& morphs);
+    void SetMorphs(const Vector<ModelMorph>& morphs);
     
     
     /// Return bounding box
     /// Return bounding box
     const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return skeleton
     /// Return skeleton
     Skeleton& GetSkeleton() { return skeleton_; }
     Skeleton& GetSkeleton() { return skeleton_; }
     /// Return vertex buffers
     /// Return vertex buffers
-    const std::vector<SharedPtr<VertexBuffer> >& GetVertexBuffers() const { return vertexBuffer_; }
+    const Vector<SharedPtr<VertexBuffer> >& GetVertexBuffers() const { return vertexBuffer_; }
     /// Return index buffers
     /// Return index buffers
-    const std::vector<SharedPtr<IndexBuffer> >& GetIndexBuffers() const { return indexBuffers_; }
+    const Vector<SharedPtr<IndexBuffer> >& GetIndexBuffers() const { return indexBuffers_; }
     /// Return number of geometries
     /// Return number of geometries
-    unsigned GetNumGeometries() const { return geometries_.size(); }
+    unsigned GetNumGeometries() const { return geometries_.Size(); }
     /// Return number of LOD levels in geometry
     /// Return number of LOD levels in geometry
     unsigned GetNumGeometryLodLevels(unsigned index) const;
     unsigned GetNumGeometryLodLevels(unsigned index) const;
     /// Return geometry pointers
     /// Return geometry pointers
-    const std::vector<std::vector<SharedPtr<Geometry> > >& GetGeometries() const { return geometries_; }
+    const Vector<Vector<SharedPtr<Geometry> > >& GetGeometries() const { return geometries_; }
     /// Return geometry by index and LOD level
     /// Return geometry by index and LOD level
     Geometry* GetGeometry(unsigned index, unsigned lodLevel) const;
     Geometry* GetGeometry(unsigned index, unsigned lodLevel) const;
     /// Return geometery bone mappings
     /// Return geometery bone mappings
-    const std::vector<std::vector<unsigned> >& GetGeometryBoneMappings() const { return geometryBoneMappings_; }
+    const Vector<Vector<unsigned> >& GetGeometryBoneMappings() const { return geometryBoneMappings_; }
     /// Return vertex morphs
     /// Return vertex morphs
-    const std::vector<ModelMorph>& GetMorphs() const { return morphs_; }
+    const Vector<ModelMorph>& GetMorphs() const { return morphs_; }
     /// Return number of vertex morphs
     /// Return number of vertex morphs
-    unsigned GetNumMorphs() const { return morphs_.size(); }
+    unsigned GetNumMorphs() const { return morphs_.Size(); }
     /// Return vertex morph by index
     /// Return vertex morph by index
     const ModelMorph* GetMorph(unsigned index) const;
     const ModelMorph* GetMorph(unsigned index) const;
     /// Return vertex morph by name
     /// Return vertex morph by name
@@ -126,13 +126,13 @@ private:
     /// Skeleton
     /// Skeleton
     Skeleton skeleton_;
     Skeleton skeleton_;
     /// Vertex buffer pointers
     /// Vertex buffer pointers
-    std::vector<SharedPtr<VertexBuffer> > vertexBuffer_;
+    Vector<SharedPtr<VertexBuffer> > vertexBuffer_;
     /// Index buffer pointers
     /// Index buffer pointers
-    std::vector<SharedPtr<IndexBuffer> > indexBuffers_;
+    Vector<SharedPtr<IndexBuffer> > indexBuffers_;
     /// Geometry pointers
     /// Geometry pointers
-    std::vector<std::vector<SharedPtr<Geometry> > > geometries_;
+    Vector<Vector<SharedPtr<Geometry> > > geometries_;
     /// Geometry bone mappings
     /// Geometry bone mappings
-    std::vector<std::vector<unsigned> > geometryBoneMappings_;
+    Vector<Vector<unsigned> > geometryBoneMappings_;
     /// Vertex morphs
     /// Vertex morphs
-    std::vector<ModelMorph> morphs_;
+    Vector<ModelMorph> morphs_;
 };
 };

+ 6 - 6
Engine/Graphics/OcclusionBuffer.cpp

@@ -81,7 +81,7 @@ bool OcclusionBuffer::SetSize(int width, int height)
     // Reserve extra memory in case 3D clipping is not exact
     // Reserve extra memory in case 3D clipping is not exact
     fullBuffer_ = new int[width * (height + 2)];
     fullBuffer_ = new int[width * (height + 2)];
     buffer_ = fullBuffer_.GetPtr() + 1 * width;
     buffer_ = fullBuffer_.GetPtr() + 1 * width;
-    mipBuffers_.clear();
+    mipBuffers_.Clear();
     
     
     // Build buffers for mip levels
     // Build buffers for mip levels
     for (;;)
     for (;;)
@@ -89,14 +89,14 @@ bool OcclusionBuffer::SetSize(int width, int height)
         width = (width + 1) / 2;
         width = (width + 1) / 2;
         height = (height + 1) / 2;
         height = (height + 1) / 2;
         
         
-        mipBuffers_.push_back(SharedArrayPtr<DepthValue>(new DepthValue[width * height]));
+        mipBuffers_.Push(SharedArrayPtr<DepthValue>(new DepthValue[width * height]));
         
         
         if ((width <= OCCLUSION_MIN_SIZE) && (height <= OCCLUSION_MIN_SIZE))
         if ((width <= OCCLUSION_MIN_SIZE) && (height <= OCCLUSION_MIN_SIZE))
             break;
             break;
     }
     }
     
     
     LOGINFO("Set occlusion buffer size " + ToString(width_) + "x" + ToString(height_) + " with " + 
     LOGINFO("Set occlusion buffer size " + ToString(width_) + "x" + ToString(height_) + " with " + 
-        ToString(mipBuffers_.size()) + " mip levels");
+        ToString(mipBuffers_.Size()) + " mip levels");
     
     
     CalculateViewport();
     CalculateViewport();
     return true;
     return true;
@@ -216,7 +216,7 @@ void OcclusionBuffer::BuildDepthHierarchy()
     // Build the first mip level from the pixel-level data
     // Build the first mip level from the pixel-level data
     int width = (width_ + 1) / 2;
     int width = (width_ + 1) / 2;
     int height = (height_ + 1) / 2;
     int height = (height_ + 1) / 2;
-    if (mipBuffers_.size())
+    if (mipBuffers_.Size())
     {
     {
         for (int y = 0; y < height; ++y)
         for (int y = 0; y < height; ++y)
         {
         {
@@ -256,7 +256,7 @@ void OcclusionBuffer::BuildDepthHierarchy()
     }
     }
     
     
     // Build the rest of the mip levels
     // Build the rest of the mip levels
-    for (unsigned i = 1; i < mipBuffers_.size(); ++i)
+    for (unsigned i = 1; i < mipBuffers_.Size(); ++i)
     {
     {
         int prevWidth = width;
         int prevWidth = width;
         int prevHeight = height;
         int prevHeight = height;
@@ -382,7 +382,7 @@ bool OcclusionBuffer::IsVisible(const BoundingBox& worldSpaceBox) const
     if (!depthHierarchyDirty_)
     if (!depthHierarchyDirty_)
     {
     {
         // Start from lowest mip level and check if a conclusive result can be found
         // Start from lowest mip level and check if a conclusive result can be found
-        for (int i = mipBuffers_.size() - 1; i >= 0; --i)
+        for (int i = mipBuffers_.Size() - 1; i >= 0; --i)
         {
         {
             int shift = i + 1;
             int shift = i + 1;
             int width = width_ >> shift;
             int width = width_ >> shift;

+ 2 - 2
Engine/Graphics/OcclusionBuffer.h

@@ -27,7 +27,7 @@
 #include "GraphicsDefs.h"
 #include "GraphicsDefs.h"
 #include "SharedArrayPtr.h"
 #include "SharedArrayPtr.h"
 
 
-#include <vector>
+#include "Vector.h"
 
 
 class BoundingBox;
 class BoundingBox;
 class Camera;
 class Camera;
@@ -155,5 +155,5 @@ private:
     /// Highest level buffer with safety padding
     /// Highest level buffer with safety padding
     SharedArrayPtr<int> fullBuffer_;
     SharedArrayPtr<int> fullBuffer_;
     /// Reduced size depth buffers
     /// Reduced size depth buffers
-    std::vector<SharedArrayPtr<DepthValue> > mipBuffers_;
+    Vector<SharedArrayPtr<DepthValue> > mipBuffers_;
 };
 };

+ 21 - 21
Engine/Graphics/Octree.cpp

@@ -28,7 +28,7 @@
 #include "Octree.h"
 #include "Octree.h"
 #include "OctreeQuery.h"
 #include "OctreeQuery.h"
 
 
-#include <algorithm>
+#include "Sort.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
@@ -39,7 +39,7 @@
 static const float DEFAULT_OCTREE_SIZE = 1000.0f;
 static const float DEFAULT_OCTREE_SIZE = 1000.0f;
 static const int DEFAULT_OCTREE_LEVELS = 8;
 static const int DEFAULT_OCTREE_LEVELS = 8;
 
 
-inline static bool CompareRayQueryResults(const RayQueryResult& lhs, const RayQueryResult& rhs)
+inline bool CompareRayQueryResults(const RayQueryResult& lhs, const RayQueryResult& rhs)
 {
 {
     return lhs.distance_ < rhs.distance_;
     return lhs.distance_ < rhs.distance_;
 }
 }
@@ -186,7 +186,7 @@ void Octant::GetDrawablesInternal(OctreeQuery& query, unsigned mask) const
             mask = M_MAX_UNSIGNED;
             mask = M_MAX_UNSIGNED;
     }
     }
     
     
-    for (std::vector<Drawable*>::const_iterator i = drawables_.begin(); i != drawables_.end(); ++i)
+    for (Vector<Drawable*>::ConstIterator i = drawables_.Begin(); i != drawables_.End(); ++i)
     {
     {
         Drawable* drawable = *i;
         Drawable* drawable = *i;
         unsigned flags = drawable->GetDrawableFlags();
         unsigned flags = drawable->GetDrawableFlags();
@@ -199,7 +199,7 @@ void Octant::GetDrawablesInternal(OctreeQuery& query, unsigned mask) const
             continue;
             continue;
         
         
         if (query.TestDrawable(drawable->GetWorldBoundingBox(), mask) != OUTSIDE)
         if (query.TestDrawable(drawable->GetWorldBoundingBox(), mask) != OUTSIDE)
-            query.result_.push_back(drawable);
+            query.result_.Push(drawable);
     }
     }
     
     
     for (unsigned i = 0; i < NUM_OCTANTS; ++i)
     for (unsigned i = 0; i < NUM_OCTANTS; ++i)
@@ -218,7 +218,7 @@ void Octant::GetDrawablesInternal(RayOctreeQuery& query) const
     if (octantDist >= query.maxDistance_)
     if (octantDist >= query.maxDistance_)
         return;
         return;
     
     
-    for (std::vector<Drawable*>::const_iterator i = drawables_.begin(); i != drawables_.end(); ++i)
+    for (Vector<Drawable*>::ConstIterator i = drawables_.Begin(); i != drawables_.End(); ++i)
     {
     {
         Drawable* drawable = *i;
         Drawable* drawable = *i;
         unsigned drawableFlags = drawable->GetDrawableFlags();
         unsigned drawableFlags = drawable->GetDrawableFlags();
@@ -248,19 +248,19 @@ 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 (std::vector<Drawable*>::iterator i = drawables_.begin(); i != drawables_.end(); ++i)
+        for (Vector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
         {
         {
             (*i)->SetOctant(root_);
             (*i)->SetOctant(root_);
-            root_->drawables_.push_back(*i);
+            root_->drawables_.Push(*i);
             root_->QueueReinsertion(*i);
             root_->QueueReinsertion(*i);
         }
         }
-        drawables_.clear();
+        drawables_.Clear();
         numDrawables_ = 0;
         numDrawables_ = 0;
     }
     }
     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 (std::vector<Drawable*>::iterator i = drawables_.begin(); i != drawables_.end(); ++i)
+        for (Vector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
             (*i)->SetOctant(0);
             (*i)->SetOctant(0);
     }
     }
     
     
@@ -321,7 +321,7 @@ void Octree::Resize(const BoundingBox& box, unsigned numLevels)
     
     
     worldBoundingBox_ = box;
     worldBoundingBox_ = box;
     cullingBox_ = BoundingBox(worldBoundingBox_.min_ - halfSize, worldBoundingBox_.max_ + halfSize);
     cullingBox_ = BoundingBox(worldBoundingBox_.min_ - halfSize, worldBoundingBox_.max_ + halfSize);
-    numDrawables_ = drawables_.size();
+    numDrawables_ = drawables_.Size();
     numLevels_ = numLevels;
     numLevels_ = numLevels;
 }
 }
 
 
@@ -331,7 +331,7 @@ void Octree::Update(const FrameInfo& frame)
         PROFILE(UpdateDrawables);
         PROFILE(UpdateDrawables);
         
         
         // Let drawables update themselves before reinsertion
         // Let drawables update themselves before reinsertion
-        for (std::set<Drawable*>::iterator i = drawableUpdates_.begin(); i != drawableUpdates_.end(); ++i)
+        for (Set<Drawable*>::Iterator i = drawableUpdates_.Begin(); i != drawableUpdates_.End(); ++i)
             (*i)->Update(frame);
             (*i)->Update(frame);
     }
     }
     
     
@@ -339,7 +339,7 @@ void Octree::Update(const FrameInfo& frame)
         PROFILE(ReinsertDrawables);
         PROFILE(ReinsertDrawables);
         
         
         // Reinsert drawables into the octree
         // Reinsert drawables into the octree
-        for (std::set<Drawable*>::iterator i = drawableReinsertions_.begin(); i != drawableReinsertions_.end(); ++i)
+        for (Set<Drawable*>::Iterator i = drawableReinsertions_.Begin(); i != drawableReinsertions_.End(); ++i)
         {
         {
             Drawable* drawable = *i;
             Drawable* drawable = *i;
             Octant* octant = drawable->GetOctant();
             Octant* octant = drawable->GetOctant();
@@ -370,15 +370,15 @@ void Octree::Update(const FrameInfo& frame)
         }
         }
     }
     }
     
     
-    drawableUpdates_.clear();
-    drawableReinsertions_.clear();
+    drawableUpdates_.Clear();
+    drawableReinsertions_.Clear();
 }
 }
 
 
 void Octree::GetDrawables(OctreeQuery& query) const
 void Octree::GetDrawables(OctreeQuery& query) const
 {
 {
     PROFILE(OctreeQuery);
     PROFILE(OctreeQuery);
     
     
-    query.result_.clear();
+    query.result_.Clear();
     GetDrawablesInternal(query, 0);
     GetDrawablesInternal(query, 0);
 }
 }
 
 
@@ -386,29 +386,29 @@ void Octree::GetDrawables(RayOctreeQuery& query) const
 {
 {
     PROFILE(Raycast);
     PROFILE(Raycast);
     
     
-    query.result_.clear();
+    query.result_.Clear();
     GetDrawablesInternal(query);
     GetDrawablesInternal(query);
-    std::sort(query.result_.begin(), query.result_.end(), CompareRayQueryResults);
+    Sort(query.result_.Begin(), query.result_.End(), CompareRayQueryResults);
 }
 }
 
 
 void Octree::QueueUpdate(Drawable* drawable)
 void Octree::QueueUpdate(Drawable* drawable)
 {
 {
-    drawableUpdates_.insert(drawable);
+    drawableUpdates_.Insert(drawable);
 }
 }
 
 
 void Octree::QueueReinsertion(Drawable* drawable)
 void Octree::QueueReinsertion(Drawable* drawable)
 {
 {
-    drawableReinsertions_.insert(drawable);
+    drawableReinsertions_.Insert(drawable);
 }
 }
 
 
 void Octree::CancelUpdate(Drawable* drawable)
 void Octree::CancelUpdate(Drawable* drawable)
 {
 {
-    drawableUpdates_.erase(drawable);
+    drawableUpdates_.Erase(drawable);
 }
 }
 
 
 void Octree::CancelReinsertion(Drawable* drawable)
 void Octree::CancelReinsertion(Drawable* drawable)
 {
 {
-    drawableReinsertions_.erase(drawable);
+    drawableReinsertions_.Erase(drawable);
 }
 }
 
 
 void Octree::DrawDebugGeometry(bool depthTest)
 void Octree::DrawDebugGeometry(bool depthTest)

+ 7 - 7
Engine/Graphics/Octree.h

@@ -25,7 +25,7 @@
 
 
 #include "Drawable.h"
 #include "Drawable.h"
 
 
-#include <set>
+#include "Set.h"
 
 
 class Drawable;
 class Drawable;
 class Octree;
 class Octree;
@@ -58,20 +58,20 @@ public:
     void AddDrawable(Drawable* drawable)
     void AddDrawable(Drawable* drawable)
     {
     {
         drawable->SetOctant(this);
         drawable->SetOctant(this);
-        drawables_.push_back(drawable);
+        drawables_.Push(drawable);
         IncDrawableCount();
         IncDrawableCount();
     }
     }
     
     
     /// 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 (std::vector<Drawable*>::iterator i = drawables_.begin(); i != drawables_.end(); ++i)
+        for (Vector<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();
                 return;
                 return;
             }
             }
@@ -141,7 +141,7 @@ protected:
     /// Octree root
     /// Octree root
     Octree* root_;
     Octree* root_;
     /// Drawable objects
     /// Drawable objects
-    std::vector<Drawable*> drawables_;
+    Vector<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_;
 };
 };
@@ -187,9 +187,9 @@ public:
     
     
 private:
 private:
     /// Set of drawable objects that require update
     /// Set of drawable objects that require update
-    std::set<Drawable*> drawableUpdates_;
+    Set<Drawable*> drawableUpdates_;
     /// Set of drawable objects that require reinsertion
     /// Set of drawable objects that require reinsertion
-    std::set<Drawable*> drawableReinsertions_;
+    Set<Drawable*> drawableReinsertions_;
     /// Subdivision level
     /// Subdivision level
     unsigned numLevels_;
     unsigned numLevels_;
 };
 };

+ 10 - 10
Engine/Graphics/OctreeQuery.h

@@ -28,7 +28,7 @@
 #include "Ray.h"
 #include "Ray.h"
 #include "Sphere.h"
 #include "Sphere.h"
 
 
-#include <vector>
+#include "Vector.h"
 
 
 class OcclusionBuffer;
 class OcclusionBuffer;
 class Drawable;
 class Drawable;
@@ -39,7 +39,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(std::vector<Drawable*>& result, unsigned char drawableFlags, bool occludersOnly, bool shadowCastersOnly) :
+    OctreeQuery(Vector<Drawable*>& result, unsigned char drawableFlags, bool occludersOnly, bool shadowCastersOnly) :
         result_(result),
         result_(result),
         drawableFlags_(drawableFlags),
         drawableFlags_(drawableFlags),
         occludersOnly_(occludersOnly),
         occludersOnly_(occludersOnly),
@@ -58,7 +58,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
-    std::vector<Drawable*>& result_;
+    Vector<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 +72,7 @@ class PointOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with point and query parameters
     /// Construct with point and query parameters
-    PointOctreeQuery(std::vector<Drawable*>& result, const Vector3& point, unsigned char drawableFlags, bool occludersOnly = false,
+    PointOctreeQuery(Vector<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 +93,7 @@ class SphereOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with sphere and query parameters
     /// Construct with sphere and query parameters
-    SphereOctreeQuery(std::vector<Drawable*>& result, const Sphere& sphere, unsigned char drawableFlags, bool occludersOnly = false,
+    SphereOctreeQuery(Vector<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 +114,7 @@ class BoxOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with bounding box and query parameters
     /// Construct with bounding box and query parameters
-    BoxOctreeQuery(std::vector<Drawable*>& result, const BoundingBox& box, unsigned char drawableFlags, bool occludersOnly = false,
+    BoxOctreeQuery(Vector<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 +135,7 @@ class FrustumOctreeQuery : public OctreeQuery
 {
 {
 public:
 public:
     /// Construct with frustum and query parameters
     /// Construct with frustum and query parameters
-    FrustumOctreeQuery(std::vector<Drawable*>& result, const Frustum& frustum, unsigned char drawableFlags, bool occludersOnly = false,
+    FrustumOctreeQuery(Vector<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 +156,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(std::vector<Drawable*>& result, const Frustum& frustum, OcclusionBuffer* buffer,
+    OccludedFrustumOctreeQuery(Vector<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),
@@ -208,7 +208,7 @@ class RayOctreeQuery
 {
 {
 public:
 public:
     /// Construct with ray and query parameters
     /// Construct with ray and query parameters
-    RayOctreeQuery(std::vector<RayQueryResult>& result, const Ray& ray, unsigned char drawableFlags, bool occludersOnly = false,
+    RayOctreeQuery(Vector<RayQueryResult>& result, const Ray& ray, unsigned char drawableFlags, bool occludersOnly = false,
         bool shadowCastersOnly = false, float maxDistance = M_INFINITY, RayQueryLevel level = RAY_TRIANGLE) :
         bool shadowCastersOnly = false, float maxDistance = M_INFINITY, RayQueryLevel level = RAY_TRIANGLE) :
         ray_(ray),
         ray_(ray),
         result_(result),
         result_(result),
@@ -223,7 +223,7 @@ public:
     /// Ray
     /// Ray
     Ray ray_;
     Ray ray_;
     /// Result vector reference
     /// Result vector reference
-    std::vector<RayQueryResult>& result_;
+    Vector<RayQueryResult>& result_;
     /// Drawable flags to include
     /// Drawable flags to include
     unsigned char drawableFlags_;
     unsigned char drawableFlags_;
     /// Get occluders only flag
     /// Get occluders only flag

+ 24 - 24
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_, std::vector<unsigned char>(), AM_SERIALIZATION);
-    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Billboards", billboards_, std::vector<unsigned char>(), AM_SERIALIZATION);
+    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Particles", particles_, Vector<unsigned char>(), AM_SERIALIZATION);
+    ATTRIBUTE_MODE(ParticleEmitter, VAR_BUFFER, "Billboards", billboards_, Vector<unsigned char>(), AM_SERIALIZATION);
 }
 }
 
 
 void ParticleEmitter::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
 void ParticleEmitter::OnSetAttribute(const AttributeInfo& attr, const Variant& value)
@@ -105,7 +105,7 @@ void ParticleEmitter::OnSetAttribute(const AttributeInfo& attr, const Variant& v
         {
         {
             MemoryBuffer buf(value.GetBuffer());
             MemoryBuffer buf(value.GetBuffer());
             SetNumParticles(buf.ReadVLE());
             SetNumParticles(buf.ReadVLE());
-            for (std::vector<Particle>::iterator i = particles_.begin(); i != particles_.end(); ++i)
+            for (Vector<Particle>::Iterator i = particles_.Begin(); i != particles_.End(); ++i)
             {
             {
                 i->velocity_ = buf.ReadVector3();
                 i->velocity_ = buf.ReadVector3();
                 i->size_ = buf.ReadVector2();
                 i->size_ = buf.ReadVector2();
@@ -135,8 +135,8 @@ Variant ParticleEmitter::OnGetAttribute(const AttributeInfo& attr)
     case offsetof(ParticleEmitter, particles_):
     case offsetof(ParticleEmitter, particles_):
         {
         {
             VectorBuffer buf;
             VectorBuffer buf;
-            buf.WriteVLE(particles_.size());
-            for (std::vector<Particle>::const_iterator i = particles_.begin(); i != particles_.end(); ++i)
+            buf.WriteVLE(particles_.Size());
+            for (Vector<Particle>::ConstIterator i = particles_.Begin(); i != particles_.End(); ++i)
             {
             {
                 buf.WriteVector3(i->velocity_);
                 buf.WriteVector3(i->velocity_);
                 buf.WriteVector2(i->size_);
                 buf.WriteVector2(i->size_);
@@ -168,8 +168,8 @@ void ParticleEmitter::Update(float timeStep)
     PROFILE(UpdateParticleEmitter);
     PROFILE(UpdateParticleEmitter);
     
     
     // If there is an amount mismatch between particles and billboards, correct it
     // If there is an amount mismatch between particles and billboards, correct it
-    if (particles_.size() != billboards_.size())
-        SetNumBillboards(particles_.size());
+    if (particles_.Size() != billboards_.Size())
+        SetNumBillboards(particles_.Size());
     
     
     bool needBillboardUpdate = false;
     bool needBillboardUpdate = false;
     
     
@@ -211,7 +211,7 @@ void ParticleEmitter::Update(float timeStep)
     if ((scaled_) && (!relative_))
     if ((scaled_) && (!relative_))
         scaleVector = GetWorldScale();
         scaleVector = GetWorldScale();
     
     
-    for (unsigned i = 0; i < particles_.size(); ++i)
+    for (unsigned i = 0; i < particles_.Size(); ++i)
     {
     {
         Particle& particle = particles_[i];
         Particle& particle = particles_[i];
         Billboard& billboard = billboards_[i];
         Billboard& billboard = billboards_[i];
@@ -257,14 +257,14 @@ void ParticleEmitter::Update(float timeStep)
             
             
             // Color interpolation
             // Color interpolation
             unsigned& index = particle.colorIndex_;
             unsigned& index = particle.colorIndex_;
-            if (index < colors_.size())
+            if (index < colors_.Size())
             {
             {
-                if (index < colors_.size() - 1)
+                if (index < colors_.Size() - 1)
                 {
                 {
                     if (particle.timer_ >= colors_[index + 1].time_)
                     if (particle.timer_ >= colors_[index + 1].time_)
                         ++index;
                         ++index;
                 }
                 }
-                if (index < colors_.size() - 1)
+                if (index < colors_.Size() - 1)
                     billboard.color_ = colors_[index].interpolate(colors_[index + 1], particle.timer_);
                     billboard.color_ = colors_[index].interpolate(colors_[index + 1], particle.timer_);
                 else
                 else
                     billboard.color_ = colors_[index].color_;
                     billboard.color_ = colors_[index].color_;
@@ -272,7 +272,7 @@ void ParticleEmitter::Update(float timeStep)
             
             
             // Texture animation
             // Texture animation
             unsigned& texIndex = particle.texIndex_;
             unsigned& texIndex = particle.texIndex_;
-            if ((textureAnimation_.size()) && (texIndex < textureAnimation_.size() - 1))
+            if ((textureAnimation_.Size()) && (texIndex < textureAnimation_.Size() - 1))
             {
             {
                 if (particle.timer_ >= textureAnimation_[texIndex + 1].time_)
                 if (particle.timer_ >= textureAnimation_[texIndex + 1].time_)
                 {
                 {
@@ -383,14 +383,14 @@ bool ParticleEmitter::LoadParameters(XMLFile* file)
     
     
     if (rootElem.HasChildElement("colorfade"))
     if (rootElem.HasChildElement("colorfade"))
     {
     {
-        std::vector<ColorFade> fades;
+        Vector<ColorFade> fades;
         XMLElement colorFadeElem = rootElem.GetChildElement("colorfade");
         XMLElement colorFadeElem = rootElem.GetChildElement("colorfade");
         while (colorFadeElem)
         while (colorFadeElem)
         {
         {
             ColorFade fade;
             ColorFade fade;
             fade.color_ = colorFadeElem.GetColor("color");
             fade.color_ = colorFadeElem.GetColor("color");
             fade.time_ = colorFadeElem.GetFloat("time");
             fade.time_ = colorFadeElem.GetFloat("time");
-            fades.push_back(fade);
+            fades.Push(fade);
             
             
             colorFadeElem = colorFadeElem.GetNextElement("colorfade");
             colorFadeElem = colorFadeElem.GetNextElement("colorfade");
         }
         }
@@ -399,14 +399,14 @@ bool ParticleEmitter::LoadParameters(XMLFile* file)
     
     
     if (rootElem.HasChildElement("texanim"))
     if (rootElem.HasChildElement("texanim"))
     {
     {
-        std::vector<TextureAnimation> animations;
+        Vector<TextureAnimation> animations;
         XMLElement animElem = rootElem.GetChildElement("texanim");
         XMLElement animElem = rootElem.GetChildElement("texanim");
         while (animElem)
         while (animElem)
         {
         {
             TextureAnimation animation;
             TextureAnimation animation;
             animation.uv_ = animElem.GetRect("uv");
             animation.uv_ = animElem.GetRect("uv");
             animation.time_ = animElem.GetFloat("time");
             animation.time_ = animElem.GetFloat("time");
-            animations.push_back(animation);
+            animations.Push(animation);
             animElem = animElem.GetNextElement("texanim");
             animElem = animElem.GetNextElement("texanim");
         }
         }
         textureAnimation_ = animations;
         textureAnimation_ = animations;
@@ -427,7 +427,7 @@ void ParticleEmitter::SetActive(bool enable, bool resetPeriod)
 void ParticleEmitter::SetNumParticles(int num)
 void ParticleEmitter::SetNumParticles(int num)
 {
 {
     num = Max(num, 0);
     num = Max(num, 0);
-    particles_.resize(num);
+    particles_.Resize(num);
     SetNumBillboards(num);
     SetNumBillboards(num);
 }
 }
 
 
@@ -437,13 +437,13 @@ void ParticleEmitter::SetParticleColor(const Color& color)
     newColor.color_ = color;
     newColor.color_ = color;
     newColor.time_ = 0.0f;
     newColor.time_ = 0.0f;
     
     
-    colors_.clear();
-    colors_.push_back(newColor);
+    colors_.Clear();
+    colors_.Push(newColor);
 }
 }
 
 
-void ParticleEmitter::SetParticleColors(const std::vector<ColorFade>& colors)
+void ParticleEmitter::SetParticleColors(const Vector<ColorFade>& colors)
 {
 {
-    if (!colors.size())
+    if (!colors.Size())
         return;
         return;
     
     
     colors_ = colors;
     colors_ = colors;
@@ -471,7 +471,7 @@ void ParticleEmitter::HandleScenePostUpdate(StringHash eventType, VariantMap& ev
 bool ParticleEmitter::EmitNewParticle()
 bool ParticleEmitter::EmitNewParticle()
 {
 {
     unsigned index = GetFreeParticle();
     unsigned index = GetFreeParticle();
-    if (index >= particles_.size())
+    if (index >= particles_.Size())
         return false;
         return false;
     Particle& particle = particles_[index];
     Particle& particle = particles_[index];
     Billboard& billboard = billboards_[index];
     Billboard& billboard = billboards_[index];
@@ -530,7 +530,7 @@ bool ParticleEmitter::EmitNewParticle()
     
     
     billboard.position_ = startPos;
     billboard.position_ = startPos;
     billboard.size_ = particles_[index].size_;
     billboard.size_ = particles_[index].size_;
-    billboard.uv_ = textureAnimation_.size() ? textureAnimation_[0].uv_ : Rect::POSITIVE;
+    billboard.uv_ = textureAnimation_.Size() ? textureAnimation_[0].uv_ : Rect::POSITIVE;
     billboard.rotation_ = Lerp(rotationMin_, rotationMax_, Random(1.0f));
     billboard.rotation_ = Lerp(rotationMin_, rotationMax_, Random(1.0f));
     billboard.color_ = colors_[0].color_;
     billboard.color_ = colors_[0].color_;
     billboard.enabled_ = true;
     billboard.enabled_ = true;
@@ -540,7 +540,7 @@ bool ParticleEmitter::EmitNewParticle()
 
 
 unsigned ParticleEmitter::GetFreeParticle() const
 unsigned ParticleEmitter::GetFreeParticle() const
 {
 {
-    for (unsigned i = 0; i < billboards_.size(); ++i)
+    for (unsigned i = 0; i < billboards_.Size(); ++i)
     {
     {
         if (!billboards_[i].enabled_)
         if (!billboards_[i].enabled_)
             return i;
             return i;

+ 5 - 5
Engine/Graphics/ParticleEmitter.h

@@ -92,7 +92,7 @@ public:
     /// Return parameter XML file
     /// Return parameter XML file
     XMLFile* GetParameters() const { return parameterSource_; }
     XMLFile* GetParameters() const { return parameterSource_; }
     /// Return number of particles
     /// Return number of particles
-    unsigned GetNumParticles() const { return particles_.size(); }
+    unsigned GetNumParticles() const { return particles_.Size(); }
     /// Return whether emitter is active
     /// Return whether emitter is active
     bool IsActive() const { return active_; }
     bool IsActive() const { return active_; }
     
     
@@ -102,7 +102,7 @@ protected:
     /// Set color of particles
     /// Set color of particles
     void SetParticleColor(const Color& color);
     void SetParticleColor(const Color& color);
     /// Set color fade of particles
     /// Set color fade of particles
-    void SetParticleColors(const std::vector<ColorFade>& colors);
+    void SetParticleColors(const Vector<ColorFade>& colors);
     /// Create a new particle. Return true if there was room
     /// Create a new particle. Return true if there was room
     bool EmitNewParticle();
     bool EmitNewParticle();
     /// Return a free particle index
     /// Return a free particle index
@@ -125,11 +125,11 @@ private:
     /// Parameter XML file
     /// Parameter XML file
     SharedPtr<XMLFile> parameterSource_;
     SharedPtr<XMLFile> parameterSource_;
     /// Particles
     /// Particles
-    std::vector<Particle> particles_;
+    Vector<Particle> particles_;
     /// Color fade range
     /// Color fade range
-    std::vector<ColorFade> colors_;
+    Vector<ColorFade> colors_;
     /// Texture animation
     /// Texture animation
-    std::vector<TextureAnimation> textureAnimation_;
+    Vector<TextureAnimation> textureAnimation_;
     /// Emitter shape
     /// Emitter shape
     EmitterType emitterType_;
     EmitterType emitterType_;
     /// Emitter size
     /// Emitter size

+ 4 - 4
Engine/Graphics/Precompiled.h

@@ -25,7 +25,7 @@
 
 
 #include "StringBase.h"
 #include "StringBase.h"
 
 
-#include <algorithm>
-#include <map>
-#include <set>
-#include <vector>
+#include "Sort.h"
+#include "Map.h"
+#include "Set.h"
+#include "Vector.h"

+ 78 - 78
Engine/Graphics/Renderer.cpp

@@ -288,7 +288,7 @@ Renderer::Renderer(Context* context) :
     
     
     // Default to one of each shadow map resolution
     // Default to one of each shadow map resolution
     for (unsigned i = 0; i < NUM_SHADOWMAP_RESOLUTIONS; ++i)
     for (unsigned i = 0; i < NUM_SHADOWMAP_RESOLUTIONS; ++i)
-        shadowMaps_[i].resize(1);
+        shadowMaps_[i].Resize(1);
     
     
     // Try to initialize right now, but skip if screen mode is not yet set
     // Try to initialize right now, but skip if screen mode is not yet set
     Initialize();
     Initialize();
@@ -300,12 +300,12 @@ Renderer::~Renderer()
 
 
 void Renderer::SetNumViewports(unsigned num)
 void Renderer::SetNumViewports(unsigned num)
 {
 {
-    viewports_.resize(num);
+    viewports_.Resize(num);
 }
 }
 
 
 void Renderer::SetViewport(unsigned index, const Viewport& viewport)
 void Renderer::SetViewport(unsigned index, const Viewport& viewport)
 {
 {
-    if (index >= viewports_.size())
+    if (index >= viewports_.Size())
     {
     {
         LOGERROR("Viewport index out of bounds");
         LOGERROR("Viewport index out of bounds");
         return;
         return;
@@ -395,7 +395,7 @@ void Renderer::SetReuseShadowMaps(bool enable)
     if (reuseShadowMaps_)
     if (reuseShadowMaps_)
     {
     {
         for (unsigned i = 0; i < NUM_SHADOWMAP_RESOLUTIONS; ++i)
         for (unsigned i = 0; i < NUM_SHADOWMAP_RESOLUTIONS; ++i)
-            shadowMaps_[i].resize(1);
+            shadowMaps_[i].Resize(1);
     }
     }
     if (!CreateShadowMaps())
     if (!CreateShadowMaps())
         drawShadows_ = false;
         drawShadows_ = false;
@@ -404,9 +404,9 @@ void Renderer::SetReuseShadowMaps(bool enable)
 
 
 void Renderer::SetNumShadowMaps(unsigned full, unsigned half, unsigned quarter)
 void Renderer::SetNumShadowMaps(unsigned full, unsigned half, unsigned quarter)
 {
 {
-    shadowMaps_[0].resize(full ? full : 1);
-    shadowMaps_[1].resize(half ? half : 1);
-    shadowMaps_[2].resize(quarter ? quarter : 1);
+    shadowMaps_[0].Resize(full ? full : 1);
+    shadowMaps_[1].Resize(half ? half : 1);
+    shadowMaps_[2].Resize(quarter ? quarter : 1);
     if (!CreateShadowMaps())
     if (!CreateShadowMaps())
         drawShadows_ = false;
         drawShadows_ = false;
 }
 }
@@ -427,7 +427,7 @@ void Renderer::SetMaxOccluderTriangles(int triangles)
 void Renderer::SetOcclusionBufferSize(int size)
 void Renderer::SetOcclusionBufferSize(int size)
 {
 {
     occlusionBufferSize_ = Max(size, 1);
     occlusionBufferSize_ = Max(size, 1);
-    occlusionBuffers_.clear();
+    occlusionBuffers_.Clear();
 }
 }
 
 
 void Renderer::SetOccluderSizeThreshold(float screenSize)
 void Renderer::SetOccluderSizeThreshold(float screenSize)
@@ -437,7 +437,7 @@ void Renderer::SetOccluderSizeThreshold(float screenSize)
 
 
 const Viewport& Renderer::GetViewport(unsigned index) const
 const Viewport& Renderer::GetViewport(unsigned index) const
 {
 {
-    return index < viewports_.size() ? viewports_[index] : noViewport;
+    return index < viewports_.Size() ? viewports_[index] : noViewport;
 }
 }
 
 
 VertexShader* Renderer::GetVertexShader(const String& name, bool checkExists) const
 VertexShader* Renderer::GetVertexShader(const String& name, bool checkExists) const
@@ -470,7 +470,7 @@ unsigned Renderer::GetNumGeometries(bool allViews) const
     unsigned lastView = allViews ? numViews_ : 1;
     unsigned lastView = allViews ? numViews_ : 1;
     
     
     for (unsigned i = 0; i < lastView; ++i)
     for (unsigned i = 0; i < lastView; ++i)
-        numGeometries += views_[i]->GetGeometries().size();
+        numGeometries += views_[i]->GetGeometries().Size();
     
     
     return numGeometries;
     return numGeometries;
 }
 }
@@ -481,7 +481,7 @@ unsigned Renderer::GetNumLights(bool allViews) const
     unsigned lastView = allViews ? numViews_ : 1;
     unsigned lastView = allViews ? numViews_ : 1;
     
     
     for (unsigned i = 0; i < lastView; ++i)
     for (unsigned i = 0; i < lastView; ++i)
-        nulights_ += views_[i]->GetLights().size();
+        nulights_ += views_[i]->GetLights().Size();
     
     
     return nulights_;
     return nulights_;
 }
 }
@@ -493,9 +493,9 @@ unsigned Renderer::GetNumShadowMaps(bool allViews) const
     
     
     for (unsigned i = 0; i < lastView; ++i)
     for (unsigned i = 0; i < lastView; ++i)
     {
     {
-        const std::vector<LightBatchQueue>& lightQueues = views_[i]->GetLightQueues();
+        const Vector<LightBatchQueue>& lightQueues = views_[i]->GetLightQueues();
         
         
-        for (unsigned j = 0; j < lightQueues.size(); ++j)
+        for (unsigned j = 0; j < lightQueues.Size(); ++j)
         {
         {
             Light* light = lightQueues[j].light_;
             Light* light = lightQueues[j].light_;
             if ((light) && (light->GetShadowMap()))
             if ((light) && (light->GetShadowMap()))
@@ -512,7 +512,7 @@ unsigned Renderer::GetNumOccluders(bool allViews) const
     unsigned lastView = allViews ? numViews_ : 1;
     unsigned lastView = allViews ? numViews_ : 1;
     
     
     for (unsigned i = 0; i < lastView; ++i)
     for (unsigned i = 0; i < lastView; ++i)
-        numOccluders += views_[i]->GetOccluders().size();
+        numOccluders += views_[i]->GetOccluders().Size();
     
     
     return numOccluders;
     return numOccluders;
 }
 }
@@ -523,7 +523,7 @@ unsigned Renderer::GetNumShadowOccluders(bool allViews) const
     unsigned lastView = allViews ? numViews_ : 1;
     unsigned lastView = allViews ? numViews_ : 1;
     
     
     for (unsigned i = 0; i < lastView; ++i)
     for (unsigned i = 0; i < lastView; ++i)
-        numShadowOccluders += views_[i]->GetShadowOccluders().size();
+        numShadowOccluders += views_[i]->GetShadowOccluders().Size();
     
     
     return numShadowOccluders;
     return numShadowOccluders;
 }
 }
@@ -540,9 +540,9 @@ const OcclusionBuffer* Renderer::GetOcclusionBuffer(float aspectRatio, bool half
     }
     }
     int searchKey = (width << 12) | height;
     int searchKey = (width << 12) | height;
     
     
-    std::map<int, SharedPtr<OcclusionBuffer> >::iterator i = occlusionBuffers_.find(searchKey);
-    if (i != occlusionBuffers_.end())
-        return i->second;
+    Map<int, SharedPtr<OcclusionBuffer> >::Iterator i = occlusionBuffers_.Find(searchKey);
+    if (i != occlusionBuffers_.End())
+        return i->second_;
     else
     else
         return 0;
         return 0;
 }
 }
@@ -565,7 +565,7 @@ void Renderer::Update(float timeStep)
     numShadowCameras_ = 0;
     numShadowCameras_ = 0;
     numSplitLights_ = 0;
     numSplitLights_ = 0;
     numTempNodes_ = 0;
     numTempNodes_ = 0;
-    updateOctrees_.clear();
+    updateOctrees_.Clear();
     
     
     // Reload shaders if needed
     // Reload shaders if needed
     if (shadersDirty_)
     if (shadersDirty_)
@@ -573,7 +573,7 @@ void Renderer::Update(float timeStep)
     
     
     // Process all viewports. Use reverse order, because during rendering the order will be reversed again to handle auxiliary
     // Process all viewports. Use reverse order, because during rendering the order will be reversed again to handle auxiliary
     // view dependencies correctly
     // view dependencies correctly
-    for (unsigned i = viewports_.size() - 1; i < viewports_.size(); --i)
+    for (unsigned i = viewports_.Size() - 1; i < viewports_.Size(); --i)
     {
     {
         unsigned mainView = numViews_;
         unsigned mainView = numViews_;
         Viewport& viewport = viewports_[i];
         Viewport& viewport = viewports_[i];
@@ -584,14 +584,14 @@ void Renderer::Update(float timeStep)
         // However, if the same scene is viewed from multiple cameras, update the octree only once
         // However, if the same scene is viewed from multiple cameras, update the octree only once
         Octree* octree = viewport.scene_->GetComponent<Octree>();
         Octree* octree = viewport.scene_->GetComponent<Octree>();
         DebugRenderer* debug = viewport.scene_->GetComponent<DebugRenderer>();
         DebugRenderer* debug = viewport.scene_->GetComponent<DebugRenderer>();
-        if (updateOctrees_.find(octree) == updateOctrees_.end())
+        if (updateOctrees_.Find(octree) == updateOctrees_.End())
         {
         {
             frame_.camera_ = viewport.camera_;
             frame_.camera_ = viewport.camera_;
             frame_.viewSize_ = IntVector2(viewport.rect_.right_ - viewport.rect_.left_, viewport.rect_.bottom_ - viewport.rect_.top_);
             frame_.viewSize_ = IntVector2(viewport.rect_.right_ - viewport.rect_.left_, viewport.rect_.bottom_ - viewport.rect_.top_);
             if (frame_.viewSize_ == IntVector2::ZERO)
             if (frame_.viewSize_ == IntVector2::ZERO)
                 frame_.viewSize_ = IntVector2(graphics_->GetWidth(), graphics_->GetHeight());
                 frame_.viewSize_ = IntVector2(graphics_->GetWidth(), graphics_->GetHeight());
             octree->Update(frame_);
             octree->Update(frame_);
-            updateOctrees_.insert(octree);
+            updateOctrees_.Insert(octree);
             
             
             // Set also the view for the debug graphics already here, so that it can use culling
             // Set also the view for the debug graphics already here, so that it can use culling
             /// \todo May result in incorrect debug geometry culling if the same scene is drawn from multiple viewports
             /// \todo May result in incorrect debug geometry culling if the same scene is drawn from multiple viewports
@@ -652,8 +652,8 @@ void Renderer::DrawDebugGeometry(bool depthTest)
     PROFILE(RendererDrawDebug);
     PROFILE(RendererDrawDebug);
     
     
     /// \todo Because debug geometry is per-scene, if two cameras show views of the same area, occlusion is not shown correctly
     /// \todo Because debug geometry is per-scene, if two cameras show views of the same area, occlusion is not shown correctly
-    std::set<Drawable*> processedGeometries;
-    std::set<Light*> processedLights;
+    Set<Drawable*> processedGeometries;
+    Set<Light*> processedLights;
     
     
     for (unsigned i = 0; i < numViews_; ++i)
     for (unsigned i = 0; i < numViews_; ++i)
     {
     {
@@ -671,23 +671,23 @@ void Renderer::DrawDebugGeometry(bool depthTest)
         if (!debug)
         if (!debug)
             continue;
             continue;
         
         
-        const std::vector<Drawable*>& geometries = view->GetGeometries();
-        const std::vector<Light*>& lights = view->GetLights();
+        const Vector<Drawable*>& geometries = view->GetGeometries();
+        const Vector<Light*>& lights = view->GetLights();
         
         
-        for (unsigned i = 0; i < geometries.size(); ++i)
+        for (unsigned i = 0; i < geometries.Size(); ++i)
         {
         {
-            if (processedGeometries.find(geometries[i]) == processedGeometries.end())
+            if (processedGeometries.Find(geometries[i]) == processedGeometries.End())
             {
             {
                 geometries[i]->DrawDebugGeometry(debug, depthTest);
                 geometries[i]->DrawDebugGeometry(debug, depthTest);
-                processedGeometries.insert(geometries[i]);
+                processedGeometries.Insert(geometries[i]);
             }
             }
         }
         }
-        for (unsigned i = 0; i < lights.size(); ++i)
+        for (unsigned i = 0; i < lights.Size(); ++i)
         {
         {
-            if (processedLights.find(lights[i]) == processedLights.end())
+            if (processedLights.Find(lights[i]) == processedLights.End())
             {
             {
                 lights[i]->DrawDebugGeometry(debug, depthTest);
                 lights[i]->DrawDebugGeometry(debug, depthTest);
-                processedLights.insert(lights[i]);
+                processedLights.Insert(lights[i]);
             }
             }
         }
         }
     }
     }
@@ -730,7 +730,7 @@ void Renderer::Initialize()
     if (!CreateShadowMaps())
     if (!CreateShadowMaps())
         drawShadows_ = false;
         drawShadows_ = false;
     
     
-    viewports_.resize(1);
+    viewports_.Resize(1);
     ResetViews();
     ResetViews();
     
     
     LOGINFO("Initialized renderer");
     LOGINFO("Initialized renderer");
@@ -739,7 +739,7 @@ void Renderer::Initialize()
 
 
 void Renderer::ResetViews()
 void Renderer::ResetViews()
 {
 {
-    views_.clear();
+    views_.Clear();
     numViews_ = 0;
     numViews_ = 0;
 }
 }
 
 
@@ -755,8 +755,8 @@ bool Renderer::AddView(RenderSurface* renderTarget, const Viewport& viewport)
         }
         }
     }
     }
     
     
-    if (views_.size() <= numViews_)
-        views_.resize(numViews_ + 1);
+    if (views_.Size() <= numViews_)
+        views_.Resize(numViews_ + 1);
     if (!views_[numViews_])
     if (!views_[numViews_])
         views_[numViews_] = new View(context_);
         views_[numViews_] = new View(context_);
     
     
@@ -782,9 +782,9 @@ OcclusionBuffer* Renderer::GetOrCreateOcclusionBuffer(Camera* camera, int maxOcc
     int searchKey = (width << 12) | height;
     int searchKey = (width << 12) | height;
     
     
     SharedPtr<OcclusionBuffer> buffer;
     SharedPtr<OcclusionBuffer> buffer;
-    std::map<int, SharedPtr<OcclusionBuffer> >::iterator i = occlusionBuffers_.find(searchKey);
-    if (i != occlusionBuffers_.end())
-        buffer = i->second;
+    Map<int, SharedPtr<OcclusionBuffer> >::Iterator i = occlusionBuffers_.Find(searchKey);
+    if (i != occlusionBuffers_.End())
+        buffer = i->second_;
     else
     else
     {
     {
         buffer = new OcclusionBuffer(context_);
         buffer = new OcclusionBuffer(context_);
@@ -828,7 +828,7 @@ Texture2D* Renderer::GetShadowMap(float resolution)
         // If higher resolution shadow maps already used up, fall back to lower resolutions
         // If higher resolution shadow maps already used up, fall back to lower resolutions
         while (index < NUM_SHADOWMAP_RESOLUTIONS)
         while (index < NUM_SHADOWMAP_RESOLUTIONS)
         {
         {
-            if (shadowMapUseCount_[index] < shadowMaps_[index].size())
+            if (shadowMapUseCount_[index] < shadowMaps_[index].Size())
                 return shadowMaps_[index][shadowMapUseCount_[index]++];
                 return shadowMaps_[index][shadowMapUseCount_[index]++];
             ++index;
             ++index;
         }
         }
@@ -847,9 +847,9 @@ void Renderer::setBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     batch.pass_ = pass;
     batch.pass_ = pass;
     
     
     // Check if shaders are unloaded or need reloading
     // Check if shaders are unloaded or need reloading
-    std::vector<SharedPtr<VertexShader> >& vertexShaders = pass->GetVertexShaders();
-    std::vector<SharedPtr<PixelShader> >& pixelShaders = pass->GetPixelShaders();
-    if ((!vertexShaders.size()) || (!pixelShaders.size()) || (technique->GetShadersLoadedFrameNumber() !=
+    Vector<SharedPtr<VertexShader> >& vertexShaders = pass->GetVertexShaders();
+    Vector<SharedPtr<PixelShader> >& pixelShaders = pass->GetPixelShaders();
+    if ((!vertexShaders.Size()) || (!pixelShaders.Size()) || (technique->GetShadersLoadedFrameNumber() !=
         shadersChangedFrameNumber_))
         shadersChangedFrameNumber_))
     {
     {
         // First release all previous shaders, then load
         // First release all previous shaders, then load
@@ -858,7 +858,7 @@ void Renderer::setBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     }
     }
     
     
     // Make sure shaders are loaded now
     // Make sure shaders are loaded now
-    if ((vertexShaders.size()) && (pixelShaders.size()))
+    if ((vertexShaders.Size()) && (pixelShaders.Size()))
     {
     {
         //  Check whether is a forward lit pass. If not, there is only one pixel shader
         //  Check whether is a forward lit pass. If not, there is only one pixel shader
         PassType type = pass->GetType();
         PassType type = pass->GetType();
@@ -919,9 +919,9 @@ void Renderer::setBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     // Log error if shaders could not be assigned, but only once per technique
     // Log error if shaders could not be assigned, but only once per technique
     if ((!batch.vertexShader_) || (!batch.pixelShader_))
     if ((!batch.vertexShader_) || (!batch.pixelShader_))
     {
     {
-        if (shaderErrorDisplayed_.find(technique) == shaderErrorDisplayed_.end())
+        if (shaderErrorDisplayed_.Find(technique) == shaderErrorDisplayed_.End())
         {
         {
-            shaderErrorDisplayed_.insert(technique);
+            shaderErrorDisplayed_.Insert(technique);
             LOGERROR("Technique " + technique->GetName() + " has missing shaders");
             LOGERROR("Technique " + technique->GetName() + " has missing shaders");
         }
         }
     }
     }
@@ -997,15 +997,15 @@ void Renderer::LoadShaders()
     // Load inbuilt shaders
     // Load inbuilt shaders
     stencilVS_ = GetVertexShader("Stencil");
     stencilVS_ = GetVertexShader("Stencil");
     stencilPS_ = GetPixelShader("Stencil");
     stencilPS_ = GetPixelShader("Stencil");
-    lightVS_.clear();
-    lightPS_.clear();
+    lightVS_.Clear();
+    lightPS_.Clear();
     
     
     RenderMode mode = graphics_->GetRenderMode();
     RenderMode mode = graphics_->GetRenderMode();
     if (mode != RENDER_FORWARD)
     if (mode != RENDER_FORWARD)
     {
     {
         // There are rather many light volume shader variations, so load them later on-demand
         // There are rather many light volume shader variations, so load them later on-demand
-        lightVS_.resize(MAX_DEFERRED_LIGHT_VS_VARIATIONS);
-        lightPS_.resize(MAX_DEFERRED_LIGHT_PS_VARIATIONS);
+        lightVS_.Resize(MAX_DEFERRED_LIGHT_VS_VARIATIONS);
+        lightPS_.Resize(MAX_DEFERRED_LIGHT_PS_VARIATIONS);
         if (mode == RENDER_DEFERRED)
         if (mode == RENDER_DEFERRED)
             lightShaderName_ = "Deferred/Light_";
             lightShaderName_ = "Deferred/Light_";
         else
         else
@@ -1053,12 +1053,12 @@ void Renderer::LoadMaterialShaders(Technique* technique)
 
 
 void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowShadows)
 void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowShadows)
 {
 {
-    std::map<PassType, Pass>::iterator i = technique->passes_.find(pass);
-    if (i == technique->passes_.end())
+    Map<PassType, Pass>::Iterator i = technique->passes_.Find(pass);
+    if (i == technique->passes_.End())
         return;
         return;
     
     
-    String vertexShaderName = i->second.GetVertexShaderName();
-    String pixelShaderName = i->second.GetPixelShaderName();
+    String vertexShaderName = i->second_.GetVertexShaderName();
+    String pixelShaderName = i->second_.GetPixelShaderName();
     
     
     // Check if the shader name is already a variation in itself
     // Check if the shader name is already a variation in itself
     if (vertexShaderName.Find('_') == String::NPOS)
     if (vertexShaderName.Find('_') == String::NPOS)
@@ -1075,18 +1075,18 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
     
     
     unsigned hwShadows = graphics_->GetHardwareShadowSupport() ? 1 : 0;
     unsigned hwShadows = graphics_->GetHardwareShadowSupport() ? 1 : 0;
     
     
-    std::vector<SharedPtr<VertexShader> >& vertexShaders = i->second.GetVertexShaders();
-    std::vector<SharedPtr<PixelShader> >& pixelShaders = i->second.GetPixelShaders();
+    Vector<SharedPtr<VertexShader> >& vertexShaders = i->second_.GetVertexShaders();
+    Vector<SharedPtr<PixelShader> >& pixelShaders = i->second_.GetPixelShaders();
     
     
     // Forget all the old shaders
     // Forget all the old shaders
-    vertexShaders.clear();
-    pixelShaders.clear();
+    vertexShaders.Clear();
+    pixelShaders.Clear();
     
     
-    switch (i->first)
+    switch (i->first_)
     {
     {
     default:
     default:
-        vertexShaders.resize(MAX_GEOMETRYTYPES);
-        pixelShaders.resize(1);
+        vertexShaders.Resize(MAX_GEOMETRYTYPES);
+        pixelShaders.Resize(1);
         for (unsigned j = 0; j < MAX_GEOMETRYTYPES; ++j)
         for (unsigned j = 0; j < MAX_GEOMETRYTYPES; ++j)
             vertexShaders[j] = GetVertexShader(vertexShaderName + geometryVSVariations[j], j != 0);
             vertexShaders[j] = GetVertexShader(vertexShaderName + geometryVSVariations[j], j != 0);
         pixelShaders[0] = GetPixelShader(pixelShaderName);
         pixelShaders[0] = GetPixelShader(pixelShaderName);
@@ -1096,10 +1096,10 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
     case PASS_LIGHT:
     case PASS_LIGHT:
         {
         {
             // In first light pass, load only directional light shaders
             // In first light pass, load only directional light shaders
-            unsigned numPS = i->first == PASS_LIGHT ? MAX_LIGHT_PS_VARIATIONS : LPS_SPOT;
+            unsigned numPS = i->first_ == PASS_LIGHT ? MAX_LIGHT_PS_VARIATIONS : LPS_SPOT;
             
             
-            vertexShaders.resize(MAX_GEOMETRYTYPES * MAX_LIGHT_VS_VARIATIONS);
-            pixelShaders.resize(numPS);
+            vertexShaders.Resize(MAX_GEOMETRYTYPES * MAX_LIGHT_VS_VARIATIONS);
+            pixelShaders.Resize(numPS);
             
             
             for (unsigned j = 0; j < MAX_GEOMETRYTYPES * MAX_LIGHT_VS_VARIATIONS; ++j)
             for (unsigned j = 0; j < MAX_GEOMETRYTYPES * MAX_LIGHT_VS_VARIATIONS; ++j)
             {
             {
@@ -1133,10 +1133,10 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
 
 
 void Renderer::ReleaseMaterialShaders()
 void Renderer::ReleaseMaterialShaders()
 {
 {
-    std::vector<Material*> materials;
+    Vector<Material*> materials;
     cache_->GetResources<Material>(materials);
     cache_->GetResources<Material>(materials);
     
     
-    for (unsigned i = 0; i < materials.size(); ++i)
+    for (unsigned i = 0; i < materials.Size(); ++i)
     {
     {
         for (unsigned j = 0; j < materials[i]->GetNumTechniques(); ++j)
         for (unsigned j = 0; j < materials[i]->GetNumTechniques(); ++j)
             materials[i]->ReleaseShaders();
             materials[i]->ReleaseShaders();
@@ -1145,14 +1145,14 @@ void Renderer::ReleaseMaterialShaders()
 
 
 void Renderer::ReloadTextures()
 void Renderer::ReloadTextures()
 {
 {
-    std::vector<Resource*> textures;
+    Vector<Resource*> textures;
     
     
     cache_->GetResources(textures, Texture2D::GetTypeStatic());
     cache_->GetResources(textures, Texture2D::GetTypeStatic());
-    for (unsigned i = 0; i < textures.size(); ++i)
+    for (unsigned i = 0; i < textures.Size(); ++i)
         cache_->ReloadResource(textures[i]);
         cache_->ReloadResource(textures[i]);
     
     
     cache_->GetResources(textures, TextureCube::GetTypeStatic());
     cache_->GetResources(textures, TextureCube::GetTypeStatic());
-    for (unsigned i = 0; i < textures.size(); ++i)
+    for (unsigned i = 0; i < textures.Size(); ++i)
         cache_->ReloadResource(textures[i]);
         cache_->ReloadResource(textures[i]);
 }
 }
 
 
@@ -1256,7 +1256,7 @@ bool Renderer::CreateShadowMaps()
     {
     {
         for (unsigned i = 0; i < NUM_SHADOWMAP_RESOLUTIONS; ++i)
         for (unsigned i = 0; i < NUM_SHADOWMAP_RESOLUTIONS; ++i)
         {
         {
-            for (unsigned j = 0; j < shadowMaps_[i].size(); ++j)
+            for (unsigned j = 0; j < shadowMaps_[i].Size(); ++j)
                 shadowMaps_[i][j].Reset();
                 shadowMaps_[i][j].Reset();
         }
         }
         return true;
         return true;
@@ -1271,7 +1271,7 @@ bool Renderer::CreateShadowMaps()
         if (!colorShadowMaps_[i]->SetSize(size, size, dummyColorFormat, TEXTURE_RENDERTARGET))
         if (!colorShadowMaps_[i]->SetSize(size, size, dummyColorFormat, TEXTURE_RENDERTARGET))
             return false;
             return false;
         
         
-        for (unsigned j = 0; j < shadowMaps_[i].size(); ++j)
+        for (unsigned j = 0; j < shadowMaps_[i].Size(); ++j)
         {
         {
             if (!shadowMaps_[i][j])
             if (!shadowMaps_[i][j])
                 shadowMaps_[i][j] = new Texture2D(context_);
                 shadowMaps_[i][j] = new Texture2D(context_);
@@ -1290,8 +1290,8 @@ bool Renderer::CreateShadowMaps()
 
 
 Camera* Renderer::CreateShadowCamera()
 Camera* Renderer::CreateShadowCamera()
 {
 {
-    if (numShadowCameras_ >= shadowCameraStore_.size())
-        shadowCameraStore_.push_back(SharedPtr<Camera>(new Camera(context_)));
+    if (numShadowCameras_ >= shadowCameraStore_.Size())
+        shadowCameraStore_.Push(SharedPtr<Camera>(new Camera(context_)));
     Camera* camera = shadowCameraStore_[numShadowCameras_];
     Camera* camera = shadowCameraStore_[numShadowCameras_];
     camera->SetNode(CreateTempNode());
     camera->SetNode(CreateTempNode());
     
     
@@ -1301,8 +1301,8 @@ Camera* Renderer::CreateShadowCamera()
 
 
 Light* Renderer::CreateSplitLight(Light* original)
 Light* Renderer::CreateSplitLight(Light* original)
 {
 {
-    if (numSplitLights_ >= splitLightStore_.size())
-        splitLightStore_.push_back(SharedPtr<Light>(new Light(context_)));
+    if (numSplitLights_ >= splitLightStore_.Size())
+        splitLightStore_.Push(SharedPtr<Light>(new Light(context_)));
     Light* light = splitLightStore_[numSplitLights_];
     Light* light = splitLightStore_[numSplitLights_];
     light->SetNode(CreateTempNode());
     light->SetNode(CreateTempNode());
     light->copyFrom(original);
     light->copyFrom(original);
@@ -1313,8 +1313,8 @@ Light* Renderer::CreateSplitLight(Light* original)
 
 
 Node* Renderer::CreateTempNode()
 Node* Renderer::CreateTempNode()
 {
 {
-    if (numTempNodes_ >= tempNodeStore_.size())
-        tempNodeStore_.push_back(SharedPtr<Node>(new Node(context_)));
+    if (numTempNodes_ >= tempNodeStore_.Size())
+        tempNodeStore_.Push(SharedPtr<Node>(new Node(context_)));
     Node* node = tempNodeStore_[numTempNodes_];
     Node* node = tempNodeStore_[numTempNodes_];
     
     
     ++numTempNodes_;
     ++numTempNodes_;
@@ -1462,7 +1462,7 @@ void Renderer::HandleScreenMode(StringHash eventType, VariantMap& eventData)
     {
     {
         // When screen mode changes, reload shaders and purge old views and occlusion buffers
         // When screen mode changes, reload shaders and purge old views and occlusion buffers
         shadersDirty_ = true;
         shadersDirty_ = true;
-        occlusionBuffers_.clear();
+        occlusionBuffers_.Clear();
         ResetViews();
         ResetViews();
     }
     }
 }
 }

+ 16 - 16
Engine/Graphics/Renderer.h

@@ -28,7 +28,7 @@
 #include "Drawable.h"
 #include "Drawable.h"
 #include "RenderSurface.h"
 #include "RenderSurface.h"
 
 
-#include <set>
+#include "Set.h"
 
 
 class DebugRenderer;
 class DebugRenderer;
 class Geometry;
 class Geometry;
@@ -177,7 +177,7 @@ public:
     /// Set required size (1.0 = full screen) for occluders
     /// Set required size (1.0 = full screen) for occluders
     void SetOccluderSizeThreshold(float screenSize);
     void SetOccluderSizeThreshold(float screenSize);
     /// Return number of viewports
     /// Return number of viewports
-    unsigned GetNumViewports() const { return viewports_.size(); }
+    unsigned GetNumViewports() const { return viewports_.Size(); }
     /// Return viewport
     /// Return viewport
     const Viewport& GetViewport(unsigned index) const;
     const Viewport& GetViewport(unsigned index) const;
     /// Return whether specular lighting is enabled
     /// Return whether specular lighting is enabled
@@ -199,11 +199,11 @@ public:
     /// Return whether shadow maps are reused
     /// Return whether shadow maps are reused
     bool GetReuseShadowMaps() const { return reuseShadowMaps_; }
     bool GetReuseShadowMaps() const { return reuseShadowMaps_; }
     /// Return number of full resolution shadow maps
     /// Return number of full resolution shadow maps
-    unsigned GetNumFullShadowMaps() const { return shadowMaps_[0].size(); }
+    unsigned GetNumFullShadowMaps() const { return shadowMaps_[0].Size(); }
     /// Return number of half resolution shadow maps
     /// Return number of half resolution shadow maps
-    unsigned GetNumHalfShadowMaps() const { return shadowMaps_[1].size(); }
+    unsigned GetNumHalfShadowMaps() const { return shadowMaps_[1].Size(); }
     /// Return number of quarter resolution shadow maps
     /// Return number of quarter resolution shadow maps
-    unsigned GetNumQuarterShadowMaps() const { return shadowMaps_[2].size(); }
+    unsigned GetNumQuarterShadowMaps() const { return shadowMaps_[2].Size(); }
     /// Return whether dynamic instancing is in use
     /// Return whether dynamic instancing is in use
     bool GetDynamicInstancing() const { return dynamicInstancing_; }
     bool GetDynamicInstancing() const { return dynamicInstancing_; }
     /// Return maximum number of occluder triangles
     /// Return maximum number of occluder triangles
@@ -327,7 +327,7 @@ private:
     /// Default spotlight attenuation texture
     /// Default spotlight attenuation texture
     SharedPtr<Texture2D> defaultLightSpot;
     SharedPtr<Texture2D> defaultLightSpot;
     /// Shadow maps by resolution
     /// Shadow maps by resolution
-    std::vector<SharedPtr<Texture2D> > shadowMaps_[NUM_SHADOWMAP_RESOLUTIONS];
+    Vector<SharedPtr<Texture2D> > shadowMaps_[NUM_SHADOWMAP_RESOLUTIONS];
     /// Shadow map dummy color textures by resolution
     /// Shadow map dummy color textures by resolution
     SharedPtr<Texture2D> colorShadowMaps_[NUM_SHADOWMAP_RESOLUTIONS];
     SharedPtr<Texture2D> colorShadowMaps_[NUM_SHADOWMAP_RESOLUTIONS];
     /// Shadow map use count if reusing is disabled. Is reset for each view
     /// Shadow map use count if reusing is disabled. Is reset for each view
@@ -337,25 +337,25 @@ private:
     /// Stencil rendering pixel shader
     /// Stencil rendering pixel shader
     SharedPtr<PixelShader> stencilPS_;
     SharedPtr<PixelShader> stencilPS_;
     /// Light vertex shaders
     /// Light vertex shaders
-    std::vector<SharedPtr<VertexShader> > lightVS_;
+    Vector<SharedPtr<VertexShader> > lightVS_;
     /// Light pixel shaders
     /// Light pixel shaders
-    std::vector<SharedPtr<PixelShader> > lightPS_;
+    Vector<SharedPtr<PixelShader> > lightPS_;
     /// Reusable shadow cameras
     /// Reusable shadow cameras
-    std::vector<SharedPtr<Camera> > shadowCameraStore_;
+    Vector<SharedPtr<Camera> > shadowCameraStore_;
     /// Reusable split lights
     /// Reusable split lights
-    std::vector<SharedPtr<Light> > splitLightStore_;
+    Vector<SharedPtr<Light> > splitLightStore_;
     /// Reusable temporary scene nodes
     /// Reusable temporary scene nodes
-    std::vector<SharedPtr<Node> > tempNodeStore_;
+    Vector<SharedPtr<Node> > tempNodeStore_;
     /// Occlusion buffers
     /// Occlusion buffers
-    std::map<int, SharedPtr<OcclusionBuffer> > occlusionBuffers_;
+    Map<int, SharedPtr<OcclusionBuffer> > occlusionBuffers_;
     /// Viewports
     /// Viewports
-    std::vector<Viewport> viewports_;
+    Vector<Viewport> viewports_;
     /// Views
     /// Views
-    std::vector<SharedPtr<View> > views_;
+    Vector<SharedPtr<View> > views_;
     /// Octrees that have been updated during the frame
     /// Octrees that have been updated during the frame
-    std::set<Octree*> updateOctrees_;
+    Set<Octree*> updateOctrees_;
     /// Techniques for which missing shader error has been displayed
     /// Techniques for which missing shader error has been displayed
-    std::set<Technique*> shaderErrorDisplayed_;
+    Set<Technique*> shaderErrorDisplayed_;
     /// Vertex shader format
     /// Vertex shader format
     String vsFormat_;
     String vsFormat_;
     /// Pixel shader format
     /// Pixel shader format

+ 9 - 9
Engine/Graphics/Skeleton.cpp

@@ -67,7 +67,7 @@ bool Skeleton::Load(Deserializer& source)
         if (newBone.parentIndex_ == i)
         if (newBone.parentIndex_ == i)
             rootBoneIndex_ = i;
             rootBoneIndex_ = i;
         
         
-        bones_.push_back(newBone);
+        bones_.Push(newBone);
     }
     }
     
     
     return true;
     return true;
@@ -75,10 +75,10 @@ bool Skeleton::Load(Deserializer& source)
 
 
 bool Skeleton::Save(Serializer& dest)
 bool Skeleton::Save(Serializer& dest)
 {
 {
-    if (!dest.WriteUInt(bones_.size()))
+    if (!dest.WriteUInt(bones_.Size()))
         return false;
         return false;
     
     
-    for (unsigned i = 0; i < bones_.size(); ++i)
+    for (unsigned i = 0; i < bones_.Size(); ++i)
     {
     {
         const Bone& bone = bones_[i];
         const Bone& bone = bones_[i];
         dest.WriteString(bone.name_);
         dest.WriteString(bone.name_);
@@ -106,20 +106,20 @@ void Skeleton::Define(const Skeleton& src)
     bones_ = src.GetBones();
     bones_ = src.GetBones();
     // Make sure we clear node references, if they exist
     // Make sure we clear node references, if they exist
     // (AnimatedModel will create new nodes on its own)
     // (AnimatedModel will create new nodes on its own)
-    for (std::vector<Bone>::iterator i = bones_.begin(); i != bones_.end(); ++i)
+    for (Vector<Bone>::Iterator i = bones_.Begin(); i != bones_.End(); ++i)
         i->node_.Reset();
         i->node_.Reset();
     rootBoneIndex_ = src.rootBoneIndex_;
     rootBoneIndex_ = src.rootBoneIndex_;
 }
 }
 
 
 void Skeleton::ClearBones()
 void Skeleton::ClearBones()
 {
 {
-    bones_.clear();
+    bones_.Clear();
     rootBoneIndex_ = M_MAX_UNSIGNED;
     rootBoneIndex_ = M_MAX_UNSIGNED;
 }
 }
 
 
 void Skeleton::Reset()
 void Skeleton::Reset()
 {
 {
-    for (std::vector<Bone>::iterator i = bones_.begin(); i != bones_.end(); ++i)
+    for (Vector<Bone>::Iterator i = bones_.Begin(); i != bones_.End(); ++i)
     {
     {
         if ((i->animated_) && (i->node_))
         if ((i->animated_) && (i->node_))
             i->node_->SetTransform(i->initialPosition_, i->initialRotation_, i->initialScale_);
             i->node_->SetTransform(i->initialPosition_, i->initialRotation_, i->initialScale_);
@@ -133,12 +133,12 @@ Bone* Skeleton::GetRootBone()
 
 
 Bone* Skeleton::GetBone(unsigned index)
 Bone* Skeleton::GetBone(unsigned index)
 {
 {
-    return index < bones_.size() ? &bones_[index] : (Bone*)0;
+    return index < bones_.Size() ? &bones_[index] : (Bone*)0;
 }
 }
 
 
 Bone* Skeleton::GetBone(const String& name)
 Bone* Skeleton::GetBone(const String& name)
 {
 {
-    for (std::vector<Bone>::iterator i = bones_.begin(); i != bones_.end(); ++i)
+    for (Vector<Bone>::Iterator i = bones_.Begin(); i != bones_.End(); ++i)
     {
     {
         if (i->name_ == name)
         if (i->name_ == name)
             return &(*i);
             return &(*i);
@@ -149,7 +149,7 @@ Bone* Skeleton::GetBone(const String& name)
 
 
 Bone* Skeleton::GetBone(StringHash nameHash)
 Bone* Skeleton::GetBone(StringHash nameHash)
 {
 {
-    for (std::vector<Bone>::iterator i = bones_.begin(); i != bones_.end(); ++i)
+    for (Vector<Bone>::Iterator i = bones_.Begin(); i != bones_.End(); ++i)
     {
     {
         if (i->nameHash_ == nameHash)
         if (i->nameHash_ == nameHash)
             return &(*i);
             return &(*i);

+ 4 - 4
Engine/Graphics/Skeleton.h

@@ -95,11 +95,11 @@ public:
     void Reset();
     void Reset();
     
     
     /// Return all bones
     /// Return all bones
-    const std::vector<Bone>& GetBones() const { return bones_; }
+    const Vector<Bone>& GetBones() const { return bones_; }
     /// Return modifiable bones
     /// Return modifiable bones
-    std::vector<Bone>& GetModifiableBones() { return bones_; }
+    Vector<Bone>& GetModifiableBones() { return bones_; }
     /// Return number of bones
     /// Return number of bones
-    unsigned GetNumBones() const { return bones_.size(); }
+    unsigned GetNumBones() const { return bones_.Size(); }
     /// Return root bone
     /// Return root bone
     Bone* GetRootBone();
     Bone* GetRootBone();
     /// Return bone by index
     /// Return bone by index
@@ -111,7 +111,7 @@ public:
     
     
 private:
 private:
     /// Bones
     /// Bones
-    std::vector<Bone> bones_;
+    Vector<Bone> bones_;
     /// Root bone index
     /// Root bone index
     unsigned rootBoneIndex_;
     unsigned rootBoneIndex_;
 };
 };

+ 22 - 22
Engine/Graphics/StaticModel.cpp

@@ -75,7 +75,7 @@ void StaticModel::OnSetAttribute(const AttributeInfo& attr, const Variant& value
     case offsetof(StaticModel, materials_):
     case offsetof(StaticModel, materials_):
         {
         {
             const ResourceRefList& refs = value.GetResourceRefList();
             const ResourceRefList& refs = value.GetResourceRefList();
-            for (unsigned i = 0; i < refs.ids_.size(); ++i)
+            for (unsigned i = 0; i < refs.ids_.Size(); ++i)
                 SetMaterial(i, cache->GetResource<Material>(refs.ids_[i]));
                 SetMaterial(i, cache->GetResource<Material>(refs.ids_[i]));
         }
         }
         break;
         break;
@@ -119,7 +119,7 @@ void StaticModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance)
             result.drawable_ = this;
             result.drawable_ = this;
             result.node_ = GetNode();
             result.node_ = GetNode();
             result.distance_ = initialDistance;
             result.distance_ = initialDistance;
-            query.result_.push_back(result);
+            query.result_.Push(result);
         }
         }
         break;
         break;
         
         
@@ -134,7 +134,7 @@ void StaticModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance)
                 result.drawable_ = this;
                 result.drawable_ = this;
                 result.node_ = GetNode();
                 result.node_ = GetNode();
                 result.distance_ = distance;
                 result.distance_ = distance;
-                query.result_.push_back(result);
+                query.result_.Push(result);
             }
             }
         }
         }
         break;
         break;
@@ -148,14 +148,14 @@ void StaticModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance)
             if (distance < query.maxDistance_)
             if (distance < query.maxDistance_)
             {
             {
                 // Then the actual test using triangle geometry
                 // Then the actual test using triangle geometry
-                for (unsigned i = 0; i < geometries_.size(); ++i)
+                for (unsigned i = 0; i < geometries_.Size(); ++i)
                 {
                 {
                     unsigned lodLevel;
                     unsigned lodLevel;
                     // Check whether to use same LOD as visible, or a specific LOD
                     // Check whether to use same LOD as visible, or a specific LOD
                     if (softwareLodLevel_ == M_MAX_UNSIGNED)
                     if (softwareLodLevel_ == M_MAX_UNSIGNED)
                         lodLevel = lodLevels_[i];
                         lodLevel = lodLevels_[i];
                     else
                     else
-                        lodLevel = Clamp(softwareLodLevel_, 0, geometries_[i].size());
+                        lodLevel = Clamp(softwareLodLevel_, 0, geometries_[i].Size());
                     
                     
                     Geometry* geom = geometries_[i][lodLevel];
                     Geometry* geom = geometries_[i][lodLevel];
                     if (geom)
                     if (geom)
@@ -167,7 +167,7 @@ void StaticModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance)
                             result.drawable_ = this;
                             result.drawable_ = this;
                             result.node_ = GetNode();
                             result.node_ = GetNode();
                             result.distance_ = distance;
                             result.distance_ = distance;
-                            query.result_.push_back(result);
+                            query.result_.Push(result);
                             break;
                             break;
                         }
                         }
                     }
                     }
@@ -186,7 +186,7 @@ void StaticModel::UpdateGeometry(const FrameInfo& frame)
 
 
 unsigned StaticModel::GetNumBatches()
 unsigned StaticModel::GetNumBatches()
 {
 {
-    return geometries_.size();
+    return geometries_.Size();
 }
 }
 
 
 void StaticModel::GetBatch(const FrameInfo& frame, unsigned batchIndex, Batch& batch)
 void StaticModel::GetBatch(const FrameInfo& frame, unsigned batchIndex, Batch& batch)
@@ -200,14 +200,14 @@ bool StaticModel::DrawOcclusion(OcclusionBuffer* buffer)
 {
 {
     bool success = true;
     bool success = true;
     
     
-    for (unsigned i = 0; i < geometries_.size(); ++i)
+    for (unsigned i = 0; i < geometries_.Size(); ++i)
     {
     {
         unsigned lodLevel;
         unsigned lodLevel;
         // Check whether to use same LOD as visible, or a specific LOD
         // Check whether to use same LOD as visible, or a specific LOD
         if (softwareLodLevel_ == M_MAX_UNSIGNED)
         if (softwareLodLevel_ == M_MAX_UNSIGNED)
             lodLevel = lodLevels_[i];
             lodLevel = lodLevels_[i];
         else
         else
-            lodLevel = Clamp(softwareLodLevel_, 0, geometries_[i].size());
+            lodLevel = Clamp(softwareLodLevel_, 0, geometries_[i].Size());
         
         
         Geometry* geom = geometries_[i][lodLevel];
         Geometry* geom = geometries_[i][lodLevel];
         if (!geom)
         if (!geom)
@@ -266,8 +266,8 @@ void StaticModel::SetModel(Model* model)
     
     
     // Copy the subgeometry & LOD level structure
     // Copy the subgeometry & LOD level structure
     SetNumGeometries(model->GetNumGeometries());
     SetNumGeometries(model->GetNumGeometries());
-    const std::vector<std::vector<SharedPtr<Geometry> > >& geometries = model->GetGeometries();
-    for (unsigned i = 0; i < geometries.size(); ++i)
+    const Vector<Vector<SharedPtr<Geometry> > >& geometries = model->GetGeometries();
+    for (unsigned i = 0; i < geometries.Size(); ++i)
         geometries_[i] = geometries[i];
         geometries_[i] = geometries[i];
     
     
     SetBoundingBox(model->GetBoundingBox());
     SetBoundingBox(model->GetBoundingBox());
@@ -276,13 +276,13 @@ void StaticModel::SetModel(Model* model)
 
 
 void StaticModel::SetMaterial(Material* material)
 void StaticModel::SetMaterial(Material* material)
 {
 {
-    for (unsigned i = 0; i < materials_.size(); ++i)
+    for (unsigned i = 0; i < materials_.Size(); ++i)
         materials_[i] = material;
         materials_[i] = material;
 }
 }
 
 
 bool StaticModel::SetMaterial(unsigned index, Material* material)
 bool StaticModel::SetMaterial(unsigned index, Material* material)
 {
 {
-    if (index >= materials_.size())
+    if (index >= materials_.Size())
     {
     {
         LOGERROR("Material index out of bounds");
         LOGERROR("Material index out of bounds");
         return false;
         return false;
@@ -299,7 +299,7 @@ void StaticModel::SetSoftwareLodLevel(unsigned level)
 
 
 Material* StaticModel::GetMaterial(unsigned index) const
 Material* StaticModel::GetMaterial(unsigned index) const
 {
 {
-    return index < materials_.size() ? materials_[index] : (Material*)0;
+    return index < materials_.Size() ? materials_[index] : (Material*)0;
 }
 }
 
 
 void StaticModel::SetBoundingBox(const BoundingBox& box)
 void StaticModel::SetBoundingBox(const BoundingBox& box)
@@ -310,8 +310,8 @@ void StaticModel::SetBoundingBox(const BoundingBox& box)
 
 
 void StaticModel::SetNumGeometries(unsigned num)
 void StaticModel::SetNumGeometries(unsigned num)
 {
 {
-    geometries_.resize(num);
-    materials_.resize(num);
+    geometries_.Resize(num);
+    materials_.Resize(num);
     ResetLodLevels();
     ResetLodLevels();
 }
 }
 
 
@@ -323,11 +323,11 @@ void StaticModel::OnWorldBoundingBoxUpdate()
 void StaticModel::ResetLodLevels()
 void StaticModel::ResetLodLevels()
 {
 {
     // Ensure that each subgeometry has at least one LOD level, and reset the current LOD level
     // Ensure that each subgeometry has at least one LOD level, and reset the current LOD level
-    lodLevels_.resize(geometries_.size());
-    for (unsigned i = 0; i < geometries_.size(); ++i)
+    lodLevels_.Resize(geometries_.Size());
+    for (unsigned i = 0; i < geometries_.Size(); ++i)
     {
     {
-        if (!geometries_[i].size())
-            geometries_[i].resize(1);
+        if (!geometries_[i].Size())
+            geometries_[i].Resize(1);
         lodLevels_[i] = 0;
         lodLevels_[i] = 0;
     }
     }
     
     
@@ -337,10 +337,10 @@ void StaticModel::ResetLodLevels()
 
 
 void StaticModel::CalculateLodLevels()
 void StaticModel::CalculateLodLevels()
 {
 {
-    for (unsigned i = 0; i < geometries_.size(); ++i)
+    for (unsigned i = 0; i < geometries_.Size(); ++i)
     {
     {
         unsigned j;
         unsigned j;
-        for (j = 1; j < geometries_[i].size(); ++j)
+        for (j = 1; j < geometries_[i].Size(); ++j)
         {
         {
             if ((geometries_[i][j]) && (lodDistance_ <= geometries_[i][j]->GetLodDistance()))
             if ((geometries_[i][j]) && (lodDistance_ <= geometries_[i][j]->GetLodDistance()))
                 break;
                 break;

+ 4 - 4
Engine/Graphics/StaticModel.h

@@ -69,7 +69,7 @@ public:
     /// Return model's bounding box
     /// Return model's bounding box
     const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return number of geometries
     /// Return number of geometries
-    unsigned GetNumGeometries() const { return geometries_.size(); }
+    unsigned GetNumGeometries() const { return geometries_.Size(); }
     /// Return material by geometry index
     /// Return material by geometry index
     Material* GetMaterial(unsigned index) const;
     Material* GetMaterial(unsigned index) const;
     /// Return software LOD level
     /// Return software LOD level
@@ -94,11 +94,11 @@ protected:
     /// Bounding box
     /// Bounding box
     BoundingBox boundingBox_;
     BoundingBox boundingBox_;
     /// Geometries
     /// Geometries
-    std::vector<std::vector<SharedPtr<Geometry> > > geometries_;
+    Vector<Vector<SharedPtr<Geometry> > > geometries_;
     /// LOD levels
     /// LOD levels
-    std::vector<unsigned> lodLevels_;
+    Vector<unsigned> lodLevels_;
     /// Materials
     /// Materials
-    std::vector<SharedPtr<Material> > materials_;
+    Vector<SharedPtr<Material> > materials_;
     /// Software LOD level, used in raycast and occlusion
     /// Software LOD level, used in raycast and occlusion
     unsigned softwareLodLevel_;
     unsigned softwareLodLevel_;
     
     

+ 6 - 6
Engine/Graphics/Technique.cpp

@@ -123,8 +123,8 @@ void Pass::SetPixelShader(const String& name)
 
 
 void Pass::ReleaseShaders()
 void Pass::ReleaseShaders()
 {
 {
-    vertexShaders_.clear();
-    pixelShaders_.clear();
+    vertexShaders_.Clear();
+    pixelShaders_.Clear();
 }
 }
 
 
 OBJECTTYPESTATIC(Technique);
 OBJECTTYPESTATIC(Technique);
@@ -213,7 +213,7 @@ bool Technique::Load(Deserializer& source)
     // Calculate memory use
     // Calculate memory use
     unsigned memoryUse = 0;
     unsigned memoryUse = 0;
     memoryUse += sizeof(Technique);
     memoryUse += sizeof(Technique);
-    for (std::map<PassType, Pass>::const_iterator j = passes_.begin(); j != passes_.end(); ++j)
+    for (Map<PassType, Pass>::ConstIterator j = passes_.Begin(); j != passes_.End(); ++j)
         memoryUse += sizeof(Pass);
         memoryUse += sizeof(Pass);
     
     
     SetMemoryUse(memoryUse);
     SetMemoryUse(memoryUse);
@@ -227,8 +227,8 @@ void Technique::SetIsSM3(bool enable)
 
 
 void Technique::ReleaseShaders()
 void Technique::ReleaseShaders()
 {
 {
-    for (std::map<PassType, Pass>::iterator i = passes_.begin(); i != passes_.end(); ++i)
-        i->second.ReleaseShaders();
+    for (Map<PassType, Pass>::Iterator i = passes_.Begin(); i != passes_.End(); ++i)
+        i->second_.ReleaseShaders();
 }
 }
 
 
 Pass* Technique::CreatePass(PassType pass)
 Pass* Technique::CreatePass(PassType pass)
@@ -245,7 +245,7 @@ Pass* Technique::CreatePass(PassType pass)
 
 
 void Technique::RemovePass(PassType pass)
 void Technique::RemovePass(PassType pass)
 {
 {
-    passes_.erase(pass);
+    passes_.Erase(pass);
 }
 }
 
 
 void Technique::MarkShadersLoaded(unsigned frameNumber)
 void Technique::MarkShadersLoaded(unsigned frameNumber)

+ 10 - 10
Engine/Graphics/Technique.h

@@ -74,9 +74,9 @@ public:
     /// Return pixel shader name
     /// Return pixel shader name
     const String& GetPixelShaderName() const { return pixelShaderName_; }
     const String& GetPixelShaderName() const { return pixelShaderName_; }
     /// Return vertex shaders
     /// Return vertex shaders
-    std::vector<SharedPtr<VertexShader> >& GetVertexShaders() { return vertexShaders_; }
+    Vector<SharedPtr<VertexShader> >& GetVertexShaders() { return vertexShaders_; }
     /// Return pixel shaders
     /// Return pixel shaders
-    std::vector<SharedPtr<PixelShader> >& GetPixelShaders() { return pixelShaders_; }
+    Vector<SharedPtr<PixelShader> >& GetPixelShaders() { return pixelShaders_; }
     
     
 private:
 private:
     /// Pass type
     /// Pass type
@@ -96,9 +96,9 @@ private:
     /// Pixel shader name
     /// Pixel shader name
     String pixelShaderName_;
     String pixelShaderName_;
     /// Vertex shaders
     /// Vertex shaders
-    std::vector<SharedPtr<VertexShader> > vertexShaders_;
+    Vector<SharedPtr<VertexShader> > vertexShaders_;
     /// Pixel shaders
     /// Pixel shaders
-    std::vector<SharedPtr<PixelShader> > pixelShaders_;
+    Vector<SharedPtr<PixelShader> > pixelShaders_;
 };
 };
 
 
 /// Material technique. Consists of several passes
 /// Material technique. Consists of several passes
@@ -134,15 +134,15 @@ public:
     /// Return whether has a pass
     /// Return whether has a pass
     bool HasPass(PassType pass) const
     bool HasPass(PassType pass) const
     {
     {
-        return passes_.find(pass) != passes_.end();
+        return passes_.Find(pass) != passes_.End();
     }
     }
     
     
     /// Return a pass
     /// Return a pass
     Pass* GetPass(PassType pass)
     Pass* GetPass(PassType pass)
     {
     {
-        std::map<PassType, Pass>::iterator i = passes_.find(pass);
-        if (i != passes_.end())
-            return &(i->second);
+        Map<PassType, Pass>::Iterator i = passes_.Find(pass);
+        if (i != passes_.End())
+            return &(i->second_);
         else
         else
             return 0;
             return 0;
     }
     }
@@ -150,7 +150,7 @@ public:
     /// Return whether requires Shader Model 3
     /// Return whether requires Shader Model 3
     bool IsSM3() const { return isSM3_; }
     bool IsSM3() const { return isSM3_; }
     /// Return all passes
     /// Return all passes
-    const std::map<PassType, Pass>& GetPasses() const { return passes_; }
+    const Map<PassType, Pass>& GetPasses() const { return passes_; }
     /// Return last shaders loaded frame number
     /// Return last shaders loaded frame number
     unsigned GetShadersLoadedFrameNumber() const { return shadersLoadedFrameNumber_; }
     unsigned GetShadersLoadedFrameNumber() const { return shadersLoadedFrameNumber_; }
     
     
@@ -163,5 +163,5 @@ private:
     /// Last shaders loaded frame number
     /// Last shaders loaded frame number
     unsigned shadersLoadedFrameNumber_;
     unsigned shadersLoadedFrameNumber_;
     /// Passes
     /// Passes
-    std::map<PassType, Pass> passes_;
+    Map<PassType, Pass> passes_;
 };
 };

+ 13 - 13
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)
 {
 {
-    std::vector<VertexDeclarationElement> elements;
+    Vector<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)
@@ -98,20 +98,20 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, unsigned elementMask) :
             newElement.offset_ = offset;
             newElement.offset_ = offset;
             offset += VertexBuffer::elementSize[i];
             offset += VertexBuffer::elementSize[i];
             
             
-            elements.push_back(newElement);
+            elements.Push(newElement);
         }
         }
     }
     }
     
     
     Create(graphics, elements);
     Create(graphics, elements);
 }
 }
 
 
-VertexDeclaration::VertexDeclaration(Graphics* graphics, const std::vector<VertexBuffer*>& buffers, const std::vector<unsigned>& elementMasks) :
+VertexDeclaration::VertexDeclaration(Graphics* graphics, const Vector<VertexBuffer*>& buffers, const Vector<unsigned>& elementMasks) :
     declaration_(0)
     declaration_(0)
 {
 {
     unsigned usedElementMask = 0;
     unsigned usedElementMask = 0;
-    std::vector<VertexDeclarationElement> elements;
+    Vector<VertexDeclarationElement> elements;
     
     
-    for (unsigned i = 0; i < buffers.size(); ++i)
+    for (unsigned i = 0; i < buffers.Size(); ++i)
     {
     {
         if (buffers[i])
         if (buffers[i])
         {
         {
@@ -137,7 +137,7 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const std::vector<Verte
                     newElement.offset_ = buffers[i]->GetElementOffset(element);
                     newElement.offset_ = buffers[i]->GetElementOffset(element);
                     usedElementMask |= 1 << j;
                     usedElementMask |= 1 << j;
                     
                     
-                    elements.push_back(newElement);
+                    elements.Push(newElement);
                 }
                 }
             }
             }
         }
         }
@@ -146,13 +146,13 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const std::vector<Verte
     Create(graphics, elements);
     Create(graphics, elements);
 }
 }
 
 
-VertexDeclaration::VertexDeclaration(Graphics* graphics, const std::vector<SharedPtr<VertexBuffer> >& buffers, const std::vector<unsigned>& elementMasks) :
+VertexDeclaration::VertexDeclaration(Graphics* graphics, const Vector<SharedPtr<VertexBuffer> >& buffers, const Vector<unsigned>& elementMasks) :
     declaration_(0)
     declaration_(0)
 {
 {
     unsigned usedElementMask = 0;
     unsigned usedElementMask = 0;
-    std::vector<VertexDeclarationElement> elements;
+    Vector<VertexDeclarationElement> elements;
     
     
-    for (unsigned i = 0; i < buffers.size(); ++i)
+    for (unsigned i = 0; i < buffers.Size(); ++i)
     {
     {
         if (buffers[i])
         if (buffers[i])
         {
         {
@@ -178,7 +178,7 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const std::vector<Share
                     newElement.offset_ = buffers[i]->GetElementOffset(element);
                     newElement.offset_ = buffers[i]->GetElementOffset(element);
                     usedElementMask |= 1 << j;
                     usedElementMask |= 1 << j;
                     
                     
-                    elements.push_back(newElement);
+                    elements.Push(newElement);
                 }
                 }
             }
             }
         }
         }
@@ -192,12 +192,12 @@ VertexDeclaration::~VertexDeclaration()
     Release();
     Release();
 }
 }
 
 
-void VertexDeclaration::Create(Graphics* graphics, const std::vector<VertexDeclarationElement>& elements)
+void VertexDeclaration::Create(Graphics* graphics, const Vector<VertexDeclarationElement>& elements)
 {
 {
-    SharedArrayPtr<D3DVERTEXELEMENT9> elementArray(new D3DVERTEXELEMENT9[elements.size() + 1]);
+    SharedArrayPtr<D3DVERTEXELEMENT9> elementArray(new D3DVERTEXELEMENT9[elements.Size() + 1]);
     
     
     D3DVERTEXELEMENT9* dest = elementArray;
     D3DVERTEXELEMENT9* dest = elementArray;
-    for (std::vector<VertexDeclarationElement>::const_iterator i = elements.begin(); i != elements.end(); ++i)
+    for (Vector<VertexDeclarationElement>::ConstIterator i = elements.Begin(); i != elements.End(); ++i)
     {
     {
         dest->Stream = i->stream_;
         dest->Stream = i->stream_;
         dest->Offset = i->offset_;
         dest->Offset = i->offset_;

+ 4 - 4
Engine/Graphics/VertexDeclaration.h

@@ -27,7 +27,7 @@
 #include "GraphicsDefs.h"
 #include "GraphicsDefs.h"
 
 
 #include <d3d9.h>
 #include <d3d9.h>
-#include <vector>
+#include "Vector.h"
 
 
 class Graphics;
 class Graphics;
 class VertexBuffer;
 class VertexBuffer;
@@ -50,9 +50,9 @@ public:
     /// Construct with graphics subsystem pointer and vertex element mask
     /// Construct with graphics subsystem pointer and vertex element mask
     VertexDeclaration(Graphics* graphics, unsigned elementMask);
     VertexDeclaration(Graphics* graphics, unsigned elementMask);
     /// Construct with graphics subsystem pointer and vertex buffers to base declaration on
     /// Construct with graphics subsystem pointer and vertex buffers to base declaration on
-    VertexDeclaration(Graphics* graphics, const std::vector<VertexBuffer*>& buffers, const std::vector<unsigned>& elementMasks);
+    VertexDeclaration(Graphics* graphics, const Vector<VertexBuffer*>& buffers, const Vector<unsigned>& elementMasks);
     /// Construct with graphics subsystem pointer and vertex buffers to base declaration on
     /// Construct with graphics subsystem pointer and vertex buffers to base declaration on
-    VertexDeclaration(Graphics* graphics, const std::vector<SharedPtr<VertexBuffer> >& buffers, const std::vector<unsigned>& elementMasks);
+    VertexDeclaration(Graphics* graphics, const Vector<SharedPtr<VertexBuffer> >& buffers, const Vector<unsigned>& elementMasks);
     /// Destruct
     /// Destruct
     ~VertexDeclaration();
     ~VertexDeclaration();
     
     
@@ -61,7 +61,7 @@ public:
     
     
 private:
 private:
     /// Create declaration
     /// Create declaration
-    void Create(Graphics* graphics, const std::vector<VertexDeclarationElement>& elements);
+    void Create(Graphics* graphics, const Vector<VertexDeclarationElement>& elements);
     /// Release declaration
     /// Release declaration
     void Release();
     void Release();
     
     

+ 109 - 109
Engine/Graphics/View.cpp

@@ -45,7 +45,7 @@
 #include "View.h"
 #include "View.h"
 #include "Zone.h"
 #include "Zone.h"
 
 
-#include <algorithm>
+#include "Sort.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
@@ -108,9 +108,9 @@ bool View::Define(RenderSurface* renderTarget, const Viewport& viewport)
         if ((renderTarget->GetWidth() > graphics_->GetWidth()) || (renderTarget->GetHeight() > graphics_->GetHeight()))
         if ((renderTarget->GetWidth() > graphics_->GetWidth()) || (renderTarget->GetHeight() > graphics_->GetHeight()))
         {
         {
             // Display message only once per rendertarget, do not spam each frame
             // Display message only once per rendertarget, do not spam each frame
-            if (gBufferErrorDisplayed_.find(renderTarget) == gBufferErrorDisplayed_.end())
+            if (gBufferErrorDisplayed_.Find(renderTarget) == gBufferErrorDisplayed_.End())
             {
             {
-                gBufferErrorDisplayed_.insert(renderTarget);
+                gBufferErrorDisplayed_.Insert(renderTarget);
                 LOGERROR("Render texture is larger than the G-buffer, can not render");
                 LOGERROR("Render texture is larger than the G-buffer, can not render");
             }
             }
             return false;
             return false;
@@ -171,18 +171,18 @@ void View::Update(const FrameInfo& frame)
     frame_.viewSize_ = IntVector2(width_, height_);
     frame_.viewSize_ = IntVector2(width_, height_);
     
     
     // Clear old light scissor cache, geometry, light, occluder & batch lists
     // Clear old light scissor cache, geometry, light, occluder & batch lists
-    lightScissorCache_.clear();
-    geometries_.clear();
-    geometryDepthBounds_.clear();
-    lights_.clear();
-    occluders_.clear();
-    shadowOccluders_.clear();
+    lightScissorCache_.Clear();
+    geometries_.Clear();
+    geometryDepthBounds_.Clear();
+    lights_.Clear();
+    occluders_.Clear();
+    shadowOccluders_.Clear();
     gBufferQueue_.Clear();
     gBufferQueue_.Clear();
     baseQueue_.Clear();
     baseQueue_.Clear();
     extraQueue_.Clear();
     extraQueue_.Clear();
     transparentQueue_.Clear();
     transparentQueue_.Clear();
     noShadowLightQueue_.Clear();
     noShadowLightQueue_.Clear();
-    lightQueues_.clear();
+    lightQueues_.Clear();
     
     
     // Set automatic aspect ratio if required
     // Set automatic aspect ratio if required
     if (camera_->GetAutoAspectRatio())
     if (camera_->GetAutoAspectRatio())
@@ -227,7 +227,7 @@ void View::Render()
     // If not reusing shadowmaps, render all of them first
     // If not reusing shadowmaps, render all of them first
     if (!renderer_->reuseShadowMaps_)
     if (!renderer_->reuseShadowMaps_)
     {
     {
-        for (unsigned i = 0; i < lightQueues_.size(); ++i)
+        for (unsigned i = 0; i < lightQueues_.Size(); ++i)
         {
         {
             LightBatchQueue& queue = lightQueues_[i];
             LightBatchQueue& queue = lightQueues_[i];
             if (queue.light_->GetShadowMap())
             if (queue.light_->GetShadowMap())
@@ -271,12 +271,12 @@ 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
-    std::vector<Zone*> zones;
-    PointOctreeQuery query(reinterpret_cast<std::vector<Drawable*>& >(zones), cameraPos, DRAWABLE_ZONE);
+    Vector<Zone*> zones;
+    PointOctreeQuery query(reinterpret_cast<Vector<Drawable*>& >(zones), cameraPos, DRAWABLE_ZONE);
     octree_->GetDrawables(query);
     octree_->GetDrawables(query);
     
     
     int highestZonePriority = M_MIN_INT;
     int highestZonePriority = M_MIN_INT;
-    for (unsigned i = 0; i < zones.size(); ++i)
+    for (unsigned i = 0; i < zones.Size(); ++i)
     {
     {
         Zone* zone = zones[i];
         Zone* zone = zones[i];
         if ((zone->IsInside(cameraPos)) && (zone->GetPriority() > highestZonePriority))
         if ((zone->IsInside(cameraPos)) && (zone->GetPriority() > highestZonePriority))
@@ -292,13 +292,13 @@ void View::GetDrawables()
     
     
     if (maxOccluderTriangles_ > 0)
     if (maxOccluderTriangles_ > 0)
     {
     {
-        FrustumOctreeQuery query(reinterpret_cast<std::vector<Drawable*>& >(occluders_), camera_->GetFrustum(),
+        FrustumOctreeQuery query(reinterpret_cast<Vector<Drawable*>& >(occluders_), camera_->GetFrustum(),
             DRAWABLE_GEOMETRY, true, false);
             DRAWABLE_GEOMETRY, true, false);
         
         
         octree_->GetDrawables(query);
         octree_->GetDrawables(query);
         UpdateOccluders(occluders_, camera_);
         UpdateOccluders(occluders_, camera_);
         
         
-        if (occluders_.size())
+        if (occluders_.Size())
         {
         {
             buffer = renderer_->GetOrCreateOcclusionBuffer(camera_, maxOccluderTriangles_);
             buffer = renderer_->GetOrCreateOcclusionBuffer(camera_, maxOccluderTriangles_);
             
             
@@ -329,7 +329,7 @@ void View::GetDrawables()
     Matrix4x3 view(camera_->GetInverseWorldTransform());
     Matrix4x3 view(camera_->GetInverseWorldTransform());
     unsigned cameraViewMask = camera_->GetViewMask();
     unsigned cameraViewMask = camera_->GetViewMask();
     
     
-    for (unsigned i = 0; i < tempDrawables_.size(); ++i)
+    for (unsigned i = 0; i < tempDrawables_.Size(); ++i)
     {
     {
         Drawable* drawable = tempDrawables_[i];
         Drawable* drawable = tempDrawables_[i];
         
         
@@ -362,8 +362,8 @@ void View::GetDrawables()
             bounds.min_ = geoview_Box.min_.z_;
             bounds.min_ = geoview_Box.min_.z_;
             bounds.max_ = geoview_Box.max_.z_;
             bounds.max_ = geoview_Box.max_.z_;
             
             
-            geometryDepthBounds_.push_back(bounds);
-            geometries_.push_back(drawable);
+            geometryDepthBounds_.Push(bounds);
+            geometries_.Push(drawable);
         }
         }
         else if (flags & DRAWABLE_LIGHT)
         else if (flags & DRAWABLE_LIGHT)
         {
         {
@@ -374,23 +374,23 @@ void View::GetDrawables()
                 continue;
                 continue;
             
             
             light->MarkInView(frame_);
             light->MarkInView(frame_);
-            lights_.push_back(light);
+            lights_.Push(light);
         }
         }
     }
     }
     
     
     // Sort the lights to brightest/closest first
     // Sort the lights to brightest/closest first
-    for (unsigned i = 0; i < lights_.size(); ++i)
+    for (unsigned i = 0; i < lights_.Size(); ++i)
         lights_[i]->SetIntensitySortValue(cameraPos);
         lights_[i]->SetIntensitySortValue(cameraPos);
     
     
-    std::sort(lights_.begin(), lights_.end(), CompareDrawables);
+    Sort(lights_.Begin(), lights_.End(), CompareDrawables);
 }
 }
 
 
 
 
 void View::GetBatches()
 void View::GetBatches()
 {
 {
-    std::set<LitTransparencyCheck> litTransparencies;
-    std::set<Drawable*> maxLightsDrawables;
-    std::map<Light*, unsigned> lightQueueIndex;
+    Set<LitTransparencyCheck> litTransparencies;
+    Set<Drawable*> maxLightsDrawables;
+    Map<Light*, unsigned> lightQueueIndex;
     
     
     PassType gBufferPass = PASS_DEFERRED;
     PassType gBufferPass = PASS_DEFERRED;
     PassType additionalPass = PASS_EXTRA;
     PassType additionalPass = PASS_EXTRA;
@@ -402,10 +402,10 @@ void View::GetBatches()
     
     
     // Go through lights
     // Go through lights
     {
     {
-        PROFILE_MULTIPLE(GetLightBatches, lights_.size());
+        PROFILE_MULTIPLE(GetLightBatches, lights_.Size());
         
         
         unsigned lightQueueCount = 0;
         unsigned lightQueueCount = 0;
-        for (unsigned i = 0; i < lights_.size(); ++i)
+        for (unsigned i = 0; i < lights_.Size(); ++i)
         {
         {
             Light* light = lights_[i];
             Light* light = lights_[i];
             unsigned splits = ProcessLight(light);
             unsigned splits = ProcessLight(light);
@@ -414,8 +414,8 @@ void View::GetBatches()
                 continue;
                 continue;
             
             
             // Prepare lit object + shadow caster queues for each split
             // Prepare lit object + shadow caster queues for each split
-            if (lightQueues_.size() < lightQueueCount + splits)
-                lightQueues_.resize(lightQueueCount + splits);
+            if (lightQueues_.Size() < lightQueueCount + splits)
+                lightQueues_.Resize(lightQueueCount + splits);
             unsigned prevLightQueueCount = lightQueueCount;
             unsigned prevLightQueueCount = lightQueueCount;
             
             
             for (unsigned j = 0; j < splits; ++j)
             for (unsigned j = 0; j < splits; ++j)
@@ -425,12 +425,12 @@ void View::GetBatches()
                 lightQueue.light_ = SplitLight;
                 lightQueue.light_ = SplitLight;
                 lightQueue.shadowBatches_.Clear();
                 lightQueue.shadowBatches_.Clear();
                 lightQueue.litBatches_.Clear();
                 lightQueue.litBatches_.Clear();
-                lightQueue.volumeBatches_.clear();
+                lightQueue.volumeBatches_.Clear();
                 lightQueue.lastSplit_ = false;
                 lightQueue.lastSplit_ = false;
                 
                 
                 // Loop through shadow casters
                 // Loop through shadow casters
                 Camera* shadowCamera = SplitLight->GetShadowCamera();
                 Camera* shadowCamera = SplitLight->GetShadowCamera();
-                for (unsigned k = 0; k < shadowCasters_[j].size(); ++k)
+                for (unsigned k = 0; k < shadowCasters_[j].Size(); ++k)
                 {
                 {
                     Drawable* drawable = shadowCasters_[j][k];
                     Drawable* drawable = shadowCasters_[j][k];
                     unsigned numBatches = drawable->GetNumBatches();
                     unsigned numBatches = drawable->GetNumBatches();
@@ -461,11 +461,11 @@ void View::GetBatches()
                 }
                 }
                 
                 
                 // Loop through lit geometries
                 // Loop through lit geometries
-                if (litGeometries_[j].size())
+                if (litGeometries_[j].Size())
                 {
                 {
                     bool storeLightQueue = true;
                     bool storeLightQueue = true;
                     
                     
-                    for (unsigned k = 0; k < litGeometries_[j].size(); ++k)
+                    for (unsigned k = 0; k < litGeometries_[j].Size(); ++k)
                     {
                     {
                         Drawable* drawable = litGeometries_[j][k];
                         Drawable* drawable = litGeometries_[j][k];
                         
                         
@@ -475,7 +475,7 @@ void View::GetBatches()
                         else
                         else
                         {
                         {
                             drawable->AddLight(SplitLight);
                             drawable->AddLight(SplitLight);
-                            maxLightsDrawables.insert(drawable);
+                            maxLightsDrawables.Insert(drawable);
                         }
                         }
                     }
                     }
                     
                     
@@ -494,7 +494,7 @@ void View::GetBatches()
                         
                         
                         // If light is a split point light, it must be treated as shadowed in any case for correct stencil clearing
                         // If light is a split point light, it must be treated as shadowed in any case for correct stencil clearing
                         if ((SplitLight->GetShadowMap()) || (SplitLight->GetLightType() == LIGHT_SPLITPOINT))
                         if ((SplitLight->GetShadowMap()) || (SplitLight->GetLightType() == LIGHT_SPLITPOINT))
-                            lightQueue.volumeBatches_.push_back(volumeBatch);
+                            lightQueue.volumeBatches_.Push(volumeBatch);
                         else
                         else
                         {
                         {
                             storeLightQueue = false;
                             storeLightQueue = false;
@@ -516,21 +516,21 @@ void View::GetBatches()
         }
         }
         
         
         // Resize the light queue vector now that final size is known
         // Resize the light queue vector now that final size is known
-        lightQueues_.resize(lightQueueCount);
+        lightQueues_.Resize(lightQueueCount);
     }
     }
     
     
     // Process drawables with limited light count
     // Process drawables with limited light count
-    if (maxLightsDrawables.size())
+    if (maxLightsDrawables.Size())
     {
     {
         PROFILE(GetMaxLightsBatches);
         PROFILE(GetMaxLightsBatches);
         
         
-        for (std::set<Drawable*>::iterator i = maxLightsDrawables.begin(); i != maxLightsDrawables.end(); ++i)
+        for (Set<Drawable*>::Iterator i = maxLightsDrawables.Begin(); i != maxLightsDrawables.End(); ++i)
         {
         {
             Drawable* drawable = *i;
             Drawable* drawable = *i;
             drawable->LimitLights();
             drawable->LimitLights();
-            const std::vector<Light*>& lights = drawable->GetLights();
+            const Vector<Light*>& lights = drawable->GetLights();
             
             
-            for (unsigned i = 0; i < lights.size(); ++i)
+            for (unsigned i = 0; i < lights.Size(); ++i)
             {
             {
                 Light* SplitLight = lights[i];
                 Light* SplitLight = lights[i];
                 Light* light = SplitLight->GetOriginalLight();
                 Light* light = SplitLight->GetOriginalLight();
@@ -539,9 +539,9 @@ void View::GetBatches()
                 
                 
                 // Find the correct light queue again
                 // Find the correct light queue again
                 LightBatchQueue* queue = 0;
                 LightBatchQueue* queue = 0;
-                std::map<Light*, unsigned>::iterator j = lightQueueIndex.find(SplitLight);
-                if (j != lightQueueIndex.end())
-                    queue = &lightQueues_[j->second];
+                Map<Light*, unsigned>::Iterator j = lightQueueIndex.Find(SplitLight);
+                if (j != lightQueueIndex.End())
+                    queue = &lightQueues_[j->second_];
                 
                 
                 GetLitBatches(drawable, light, SplitLight, queue, litTransparencies, gBufferPass);
                 GetLitBatches(drawable, light, SplitLight, queue, litTransparencies, gBufferPass);
             }
             }
@@ -551,7 +551,7 @@ void View::GetBatches()
     // Go through geometries for base pass batches
     // Go through geometries for base pass batches
     {
     {
         PROFILE(GetBaseBatches);
         PROFILE(GetBaseBatches);
-        for (unsigned i = 0; i < geometries_.size(); ++i)
+        for (unsigned i = 0; i < geometries_.Size(); ++i)
         {
         {
             Drawable* drawable = geometries_[i];
             Drawable* drawable = geometries_[i];
             unsigned numBatches = drawable->GetNumBatches();
             unsigned numBatches = drawable->GetNumBatches();
@@ -638,7 +638,7 @@ void View::GetBatches()
 }
 }
 
 
 void View::GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, LightBatchQueue* lightQueue,
 void View::GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, LightBatchQueue* lightQueue,
-    std::set<LitTransparencyCheck>& litTransparencies, PassType gBufferPass)
+    Set<LitTransparencyCheck>& litTransparencies, PassType gBufferPass)
 {
 {
     bool splitPointLight = SplitLight->GetLightType() == LIGHT_SPLITPOINT;
     bool splitPointLight = SplitLight->GetLightType() == LIGHT_SPLITPOINT;
     // Whether to allow shadows for transparencies, or for forward lit objects in deferred mode
     // Whether to allow shadows for transparencies, or for forward lit objects in deferred mode
@@ -712,11 +712,11 @@ void View::GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, Li
             {
             {
                 // Check if already lit
                 // Check if already lit
                 LitTransparencyCheck check(light, drawable, i);
                 LitTransparencyCheck check(light, drawable, i);
-                if (litTransparencies.find(check) != litTransparencies.end())
+                if (litTransparencies.Find(check) != litTransparencies.End())
                     continue;
                     continue;
                 // Use the original light instead of the split one, to choose correct scissor
                 // Use the original light instead of the split one, to choose correct scissor
                 litBatch.light_ = light;
                 litBatch.light_ = light;
-                litTransparencies.insert(check);
+                litTransparencies.Insert(check);
             }
             }
             
             
             renderer_->setBatchShaders(litBatch, tech, pass, allowShadows);
             renderer_->setBatchShaders(litBatch, tech, pass, allowShadows);
@@ -746,7 +746,7 @@ void View::RenderBatcheforward()
         // Render shadow maps + opaque objects' shadowed additive lighting
         // Render shadow maps + opaque objects' shadowed additive lighting
         PROFILE(RenderLights);
         PROFILE(RenderLights);
         
         
-        for (unsigned i = 0; i < lightQueues_.size(); ++i)
+        for (unsigned i = 0; i < lightQueues_.Size(); ++i)
         {
         {
             LightBatchQueue& queue = lightQueues_[i];
             LightBatchQueue& queue = lightQueues_[i];
             
             
@@ -921,7 +921,7 @@ void View::RenderBatchesDeferred()
         PROFILE(RenderLights);
         PROFILE(RenderLights);
         
         
         // Shadowed lights
         // Shadowed lights
-        for (unsigned i = 0; i < lightQueues_.size(); ++i)
+        for (unsigned i = 0; i < lightQueues_.Size(); ++i)
         {
         {
             LightBatchQueue& queue = lightQueues_[i];
             LightBatchQueue& queue = lightQueues_[i];
             
             
@@ -930,7 +930,7 @@ void View::RenderBatchesDeferred()
                 RenderShadowMap(queue);
                 RenderShadowMap(queue);
             
             
             // Light volume batches are not sorted as there should be only one of them
             // Light volume batches are not sorted as there should be only one of them
-            if (queue.volumeBatches_.size())
+            if (queue.volumeBatches_.Size())
             {
             {
                 graphics_->ClearLastParameterSources();
                 graphics_->ClearLastParameterSources();
                 
                 
@@ -947,7 +947,7 @@ void View::RenderBatchesDeferred()
                 graphics_->ResetDepthStencil();
                 graphics_->ResetDepthStencil();
                 graphics_->SetViewport(screenRect_);
                 graphics_->SetViewport(screenRect_);
                 
                 
-                for (unsigned j = 0; j < queue.volumeBatches_.size(); ++j)
+                for (unsigned j = 0; j < queue.volumeBatches_.Size(); ++j)
                 {
                 {
                     renderer_->SetupLightBatch(queue.volumeBatches_[j]);
                     renderer_->SetupLightBatch(queue.volumeBatches_[j]);
                     queue.volumeBatches_[j].Draw(graphics_);
                     queue.volumeBatches_[j].Draw(graphics_);
@@ -960,7 +960,7 @@ void View::RenderBatchesDeferred()
         }
         }
         
         
         // Non-shadowed lights
         // Non-shadowed lights
-        if (noShadowLightQueue_.sortedBatches_.size())
+        if (noShadowLightQueue_.sortedBatches_.Size())
         {
         {
             graphics_->ClearLastParameterSources();
             graphics_->ClearLastParameterSources();
             
             
@@ -977,7 +977,7 @@ void View::RenderBatchesDeferred()
             graphics_->ResetDepthStencil();
             graphics_->ResetDepthStencil();
             graphics_->SetViewport(screenRect_);
             graphics_->SetViewport(screenRect_);
             
             
-            for (unsigned i = 0; i < noShadowLightQueue_.sortedBatches_.size(); ++i)
+            for (unsigned i = 0; i < noShadowLightQueue_.sortedBatches_.Size(); ++i)
             {
             {
                 renderer_->SetupLightBatch(*noShadowLightQueue_.sortedBatches_[i]);
                 renderer_->SetupLightBatch(*noShadowLightQueue_.sortedBatches_[i]);
                 noShadowLightQueue_.sortedBatches_[i]->Draw(graphics_);
                 noShadowLightQueue_.sortedBatches_[i]->Draw(graphics_);
@@ -1061,7 +1061,7 @@ void View::RenderBatchesDeferred()
     }
     }
 }
 }
 
 
-void View::UpdateOccluders(std::vector<Drawable*>& occluders, Camera* camera)
+void View::UpdateOccluders(Vector<Drawable*>& occluders, Camera* camera)
 {
 {
     float occluderSizeThreshold_ = renderer_->GetOccluderSizeThreshold();
     float occluderSizeThreshold_ = renderer_->GetOccluderSizeThreshold();
     float halfViewSize = camera->GetHalfViewSize();
     float halfViewSize = camera->GetHalfViewSize();
@@ -1069,7 +1069,7 @@ void View::UpdateOccluders(std::vector<Drawable*>& occluders, Camera* camera)
     Vector3 cameraPos = camera->GetWorldPosition();
     Vector3 cameraPos = camera->GetWorldPosition();
     unsigned cameraViewMask = camera->GetViewMask();
     unsigned cameraViewMask = camera->GetViewMask();
     
     
-    for (unsigned i = 0; i < occluders.size(); ++i)
+    for (unsigned i = 0; i < occluders.Size(); ++i)
     {
     {
         Drawable* occluder = occluders[i];
         Drawable* occluder = occluders[i];
         occluder->UpdateDistance(frame_);
         occluder->UpdateDistance(frame_);
@@ -1115,19 +1115,19 @@ void View::UpdateOccluders(std::vector<Drawable*>& occluders, Camera* camera)
         }
         }
         else
         else
         {
         {
-            occluders.erase(occluders.begin() + i);
+            occluders.Erase(occluders.Begin() + i);
             --i;
             --i;
         }
         }
     }
     }
     
     
     // Sort occluders so that if triangle budget is exceeded, best occluders have been drawn
     // Sort occluders so that if triangle budget is exceeded, best occluders have been drawn
-    if (occluders.size())
-        std::sort(occluders.begin(), occluders.end(), CompareDrawables);
+    if (occluders.Size())
+        Sort(occluders.Begin(), occluders.End(), CompareDrawables);
 }
 }
 
 
-void View::DrawOccluders(OcclusionBuffer* buffer, const std::vector<Drawable*>& occluders)
+void View::DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occluders)
 {
 {
-    for (unsigned i = 0; i < occluders.size(); ++i)
+    for (unsigned i = 0; i < occluders.Size(); ++i)
     {
     {
         Drawable* occluder = occluders[i];
         Drawable* occluder = occluders[i];
         if (i > 0)
         if (i > 0)
@@ -1184,13 +1184,13 @@ 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<std::vector<Drawable*>& >(shadowOccluders_), shadowCamera->GetFrustum(),
+        FrustumOctreeQuery query(reinterpret_cast<Vector<Drawable*>& >(shadowOccluders_), shadowCamera->GetFrustum(),
             DRAWABLE_GEOMETRY, true, true);
             DRAWABLE_GEOMETRY, true, true);
         octree_->GetDrawables(query);
         octree_->GetDrawables(query);
         
         
         UpdateOccluders(shadowOccluders_, shadowCamera);
         UpdateOccluders(shadowOccluders_, shadowCamera);
         
         
-        if (shadowOccluders_.size())
+        if (shadowOccluders_.Size())
         {
         {
             // Shadow viewport is rectangular and consumes more CPU fillrate, so halve size
             // Shadow viewport is rectangular and consumes more CPU fillrate, so halve size
             buffer = renderer_->GetOrCreateOcclusionBuffer(shadowCamera, maxOccluderTriangles_, true);
             buffer = renderer_->GetOrCreateOcclusionBuffer(shadowCamera, maxOccluderTriangles_, true);
@@ -1204,8 +1204,8 @@ unsigned View::ProcessLight(Light* light)
     // Process each split for shadow camera update, lit geometries, and shadow casters
     // Process each split for shadow camera update, lit geometries, and shadow casters
     for (unsigned i = 0; i < numSplits; ++i)
     for (unsigned i = 0; i < numSplits; ++i)
     {
     {
-        litGeometries_[i].clear();
-        shadowCasters_[i].clear();
+        litGeometries_[i].Clear();
+        shadowCasters_[i].Clear();
     }
     }
     
     
     for (unsigned i = 0; i < numSplits; ++i)
     for (unsigned i = 0; i < numSplits; ++i)
@@ -1265,7 +1265,7 @@ unsigned View::ProcessLight(Light* light)
                 
                 
                 if (!optimize)
                 if (!optimize)
                 {
                 {
-                    for (unsigned j = 0; j < geometries_.size(); ++j)
+                    for (unsigned j = 0; j < geometries_.Size(); ++j)
                     {
                     {
                         Drawable* drawable = geometries_[j];
                         Drawable* drawable = geometries_[j];
                         const GeometryDepthBounds& bounds = geometryDepthBounds_[j];
                         const GeometryDepthBounds& bounds = geometryDepthBounds_[j];
@@ -1274,7 +1274,7 @@ unsigned View::ProcessLight(Light* light)
                         if ((bounds.min_ <= farSplit) && (bounds.max_ >= nearSplit) && (drawable->GetLightMask() &
                         if ((bounds.min_ <= farSplit) && (bounds.max_ >= nearSplit) && (drawable->GetLightMask() &
                             split->GetLightMask()))
                             split->GetLightMask()))
                         {
                         {
-                            litGeometries_[i].push_back(drawable);
+                            litGeometries_[i].Push(drawable);
                             if (generateBoxes)
                             if (generateBoxes)
                                 geometryBox.Merge(drawable->GetWorldBoundingBox().GetTransformed(lightView));
                                 geometryBox.Merge(drawable->GetWorldBoundingBox().GetTransformed(lightView));
                         }
                         }
@@ -1282,14 +1282,14 @@ unsigned View::ProcessLight(Light* light)
                 }
                 }
                 else
                 else
                 {
                 {
-                    for (unsigned j = 0; j < geometries_.size(); ++j)
+                    for (unsigned j = 0; j < geometries_.Size(); ++j)
                     {
                     {
                         Drawable* drawable = geometries_[j];
                         Drawable* drawable = geometries_[j];
                         
                         
                         // Need to check light mask only
                         // Need to check light mask only
                         if (drawable->GetLightMask() & split->GetLightMask())
                         if (drawable->GetLightMask() & split->GetLightMask())
                         {
                         {
-                            litGeometries_[i].push_back(drawable);
+                            litGeometries_[i].Push(drawable);
                             if (generateBoxes)
                             if (generateBoxes)
                                 geometryBox.Merge(drawable->GetWorldBoundingBox().GetTransformed(lightView));
                                 geometryBox.Merge(drawable->GetWorldBoundingBox().GetTransformed(lightView));
                         }
                         }
@@ -1298,7 +1298,7 @@ unsigned View::ProcessLight(Light* light)
             }
             }
             
             
             // Then get shadow casters by shadow camera frustum query. Use occlusion because of potentially many geometries
             // Then get shadow casters by shadow camera frustum query. Use occlusion because of potentially many geometries
-            if ((isSplitShadowed) && (litGeometries_[i].size()))
+            if ((isSplitShadowed) && (litGeometries_[i].Size()))
             {
             {
                 Camera* shadowCamera = split->GetShadowCamera();
                 Camera* shadowCamera = split->GetShadowCamera();
                 
                 
@@ -1339,7 +1339,7 @@ unsigned View::ProcessLight(Light* light)
         }
         }
         
         
         // Optimization: if a particular split has no shadow casters, render as unshadowed
         // Optimization: if a particular split has no shadow casters, render as unshadowed
-        if (!shadowCasters_[i].size())
+        if (!shadowCasters_[i].Size())
             split->SetShadowMap(0);
             split->SetShadowMap(0);
         
         
         // Focus shadow camera as applicable
         // Focus shadow camera as applicable
@@ -1357,8 +1357,8 @@ unsigned View::ProcessLight(Light* light)
         }
         }
         
         
         // Update count of total lit geometries & shadow casters
         // Update count of total lit geometries & shadow casters
-        numLitGeometries += litGeometries_[i].size();
-        numShadowCasters += shadowCasters_[i].size();
+        numLitGeometries += litGeometries_[i].Size();
+        numShadowCasters += shadowCasters_[i].Size();
     }
     }
     
     
     // If no lit geometries at all, no need to process further
     // If no lit geometries at all, no need to process further
@@ -1370,16 +1370,16 @@ unsigned View::ProcessLight(Light* light)
         if (numSplits > 1)
         if (numSplits > 1)
         {
         {
             // Make sure there are no duplicates
             // Make sure there are no duplicates
-            std::set<Drawable*> allLitGeometries;
+            Set<Drawable*> allLitGeometries;
             for (unsigned i = 0; i < numSplits; ++i)
             for (unsigned i = 0; i < numSplits; ++i)
             {
             {
-                for (std::vector<Drawable*>::iterator j = litGeometries_[i].begin(); j != litGeometries_[i].end(); ++j)
-                    allLitGeometries.insert(*j);
+                for (Vector<Drawable*>::Iterator j = litGeometries_[i].Begin(); j != litGeometries_[i].End(); ++j)
+                    allLitGeometries.Insert(*j);
             }
             }
             
             
-            litGeometries_[0].resize(allLitGeometries.size());
+            litGeometries_[0].Resize(allLitGeometries.Size());
             unsigned index = 0;
             unsigned index = 0;
-            for (std::set<Drawable*>::iterator i = allLitGeometries.begin(); i != allLitGeometries.end(); ++i)
+            for (Set<Drawable*>::Iterator i = allLitGeometries.Begin(); i != allLitGeometries.End(); ++i)
                 litGeometries_[0][index++] = *i;
                 litGeometries_[0][index++] = *i;
         }
         }
         
         
@@ -1391,7 +1391,7 @@ unsigned View::ProcessLight(Light* light)
     return numSplits;
     return numSplits;
 }
 }
 
 
-void View::ProcessLightQuery(unsigned splitIndex, const std::vector<Drawable*>& result, BoundingBox& geometryBox,
+void View::ProcessLightQuery(unsigned splitIndex, const Vector<Drawable*>& result, BoundingBox& geometryBox,
     BoundingBox& shadowCasterBox, bool getLitGeometries, bool GetShadowCasters)
     BoundingBox& shadowCasterBox, bool getLitGeometries, bool GetShadowCasters)
 {
 {
     Light* light = splitLights_[splitIndex];
     Light* light = splitLights_[splitIndex];
@@ -1431,7 +1431,7 @@ void View::ProcessLightQuery(unsigned splitIndex, const std::vector<Drawable*>&
     BoundingBox lightViewBox;
     BoundingBox lightViewBox;
     BoundingBox lightProjBox;
     BoundingBox lightProjBox;
     
     
-    for (unsigned i = 0; i < result.size(); ++i)
+    for (unsigned i = 0; i < result.Size(); ++i)
     {
     {
         Drawable* drawable = static_cast<Drawable*>(result[i]);
         Drawable* drawable = static_cast<Drawable*>(result[i]);
         drawable->UpdateDistance(frame_);
         drawable->UpdateDistance(frame_);
@@ -1465,7 +1465,7 @@ void View::ProcessLightQuery(unsigned splitIndex, const std::vector<Drawable*>&
                 boxGenerated = true;
                 boxGenerated = true;
             }
             }
             
             
-            litGeometries_[splitIndex].push_back(drawable);
+            litGeometries_[splitIndex].Push(drawable);
         }
         }
         
         
         // Shadow caster need not be inside main camera frustum: in that case try to detect whether
         // Shadow caster need not be inside main camera frustum: in that case try to detect whether
@@ -1500,7 +1500,7 @@ void View::ProcessLightQuery(unsigned splitIndex, const std::vector<Drawable*>&
                     drawable->MarkInShadowView(frame_);
                     drawable->MarkInShadowView(frame_);
                     drawable->UpdateGeometry(frame_);
                     drawable->UpdateGeometry(frame_);
                 }
                 }
-                shadowCasters_[splitIndex].push_back(drawable);
+                shadowCasters_[splitIndex].Push(drawable);
             }
             }
         }
         }
     }
     }
@@ -1738,9 +1738,9 @@ void View::OptimizeLightByScissor(Light* light)
 
 
 const Rect& View::GetLightScissor(Light* light)
 const Rect& View::GetLightScissor(Light* light)
 {
 {
-    std::map<Light*, Rect>::iterator i = lightScissorCache_.find(light);
-    if (i != lightScissorCache_.end())
-        return i->second;
+    Map<Light*, Rect>::Iterator i = lightScissorCache_.Find(light);
+    if (i != lightScissorCache_.End())
+        return i->second_;
     
     
     Matrix4x3 view(camera_->GetInverseWorldTransform());
     Matrix4x3 view(camera_->GetInverseWorldTransform());
     Matrix4 projection(camera_->GetProjection());
     Matrix4 projection(camera_->GetProjection());
@@ -1873,8 +1873,8 @@ Technique* View::GetTechnique(Drawable* drawable, Material*& material)
         return 0;
         return 0;
     
     
     float lodDistance = drawable->GetLodDistance();
     float lodDistance = drawable->GetLodDistance();
-    const std::vector<TechniqueEntry>& techniques = material->GetTechniques();
-    if (!techniques.size())
+    const Vector<TechniqueEntry>& techniques = material->GetTechniques();
+    if (!techniques.Size())
         return 0;
         return 0;
     
     
     // Check for suitable technique. Techniques should be ordered like this:
     // Check for suitable technique. Techniques should be ordered like this:
@@ -1882,7 +1882,7 @@ Technique* View::GetTechnique(Drawable* drawable, Material*& material)
     // Most distant & lowest quality
     // Most distant & lowest quality
     // Second most distant & highest quality
     // Second most distant & highest quality
     // ...
     // ...
-    for (unsigned i = 0; i < techniques.size(); ++i)
+    for (unsigned i = 0; i < techniques.Size(); ++i)
     {
     {
         const TechniqueEntry& entry = techniques[i];
         const TechniqueEntry& entry = techniques[i];
         Technique* technique = entry.technique_;
         Technique* technique = entry.technique_;
@@ -1893,14 +1893,14 @@ Technique* View::GetTechnique(Drawable* drawable, Material*& material)
     }
     }
     
     
     // If no suitable technique found, fallback to the last
     // If no suitable technique found, fallback to the last
-    return techniques[techniques.size() - 1].technique_;
+    return techniques[techniques.Size() - 1].technique_;
 }
 }
 
 
 void View::CheckMaterialForAuxView(Material* material)
 void View::CheckMaterialForAuxView(Material* material)
 {
 {
-    const std::vector<SharedPtr<Texture> >& textures = material->GetTextures();
+    const Vector<SharedPtr<Texture> >& textures = material->GetTextures();
     
     
-    for (unsigned i = 0; i < textures.size(); ++i)
+    for (unsigned i = 0; i < textures.Size(); ++i)
     {
     {
         // Have to check cube & 2D textures separately
         // Have to check cube & 2D textures separately
         Texture* texture = textures[i];
         Texture* texture = textures[i];
@@ -1952,7 +1952,7 @@ void View::SortBatches()
     extraQueue_.SortFrontToBack();
     extraQueue_.SortFrontToBack();
     transparentQueue_.SortBackToFront();
     transparentQueue_.SortBackToFront();
     
     
-    for (unsigned i = 0; i < lightQueues_.size(); ++i)
+    for (unsigned i = 0; i < lightQueues_.Size(); ++i)
     {
     {
         lightQueues_[i].shadowBatches_.SortFrontToBack();
         lightQueues_[i].shadowBatches_.SortFrontToBack();
         lightQueues_[i].litBatches_.SortFrontToBack();
         lightQueues_[i].litBatches_.SortFrontToBack();
@@ -1970,7 +1970,7 @@ void View::PrepareInstancingBuffer()
     totalInstances += baseQueue_.GetNumInstances();
     totalInstances += baseQueue_.GetNumInstances();
     totalInstances += extraQueue_.GetNumInstances();
     totalInstances += extraQueue_.GetNumInstances();
     
     
-    for (unsigned i = 0; i < lightQueues_.size(); ++i)
+    for (unsigned i = 0; i < lightQueues_.Size(); ++i)
     {
     {
         totalInstances += lightQueues_[i].shadowBatches_.GetNumInstances();
         totalInstances += lightQueues_[i].shadowBatches_.GetNumInstances();
         totalInstances += lightQueues_[i].litBatches_.GetNumInstances();
         totalInstances += lightQueues_[i].litBatches_.GetNumInstances();
@@ -1988,7 +1988,7 @@ void View::PrepareInstancingBuffer()
             baseQueue_.SetTransforms(lockedData, freeIndex);
             baseQueue_.SetTransforms(lockedData, freeIndex);
             extraQueue_.SetTransforms(lockedData, freeIndex);
             extraQueue_.SetTransforms(lockedData, freeIndex);
             
             
-            for (unsigned i = 0; i < lightQueues_.size(); ++i)
+            for (unsigned i = 0; i < lightQueues_.Size(); ++i)
             {
             {
                 lightQueues_[i].shadowBatches_.SetTransforms(lockedData, freeIndex);
                 lightQueues_[i].shadowBatches_.SetTransforms(lockedData, freeIndex);
                 lightQueues_[i].litBatches_.SetTransforms(lockedData, freeIndex);
                 lightQueues_[i].litBatches_.SetTransforms(lockedData, freeIndex);
@@ -2132,16 +2132,16 @@ void View::RenderBatchQueue(const BatchQueue& queue, bool useScissor, bool useLi
     graphics_->SetStencilTest(false);
     graphics_->SetStencilTest(false);
     
     
     // Priority instanced
     // Priority instanced
-    for (std::map<BatchGroupKey, BatchGroup>::const_iterator i = queue.priorityBatchGroups_.begin(); i !=
-        queue.priorityBatchGroups_.end(); ++i)
+    for (Map<BatchGroupKey, BatchGroup>::ConstIterator i = queue.priorityBatchGroups_.Begin(); i !=
+        queue.priorityBatchGroups_.End(); ++i)
     {
     {
-        const BatchGroup& group = i->second;
+        const BatchGroup& group = i->second_;
         if ((useLightBuffer) && (!group.light_))
         if ((useLightBuffer) && (!group.light_))
             graphics_->SetTexture(TU_LIGHTBUFFER, diffBuffer);
             graphics_->SetTexture(TU_LIGHTBUFFER, diffBuffer);
         group.Draw(graphics_, instancingBuffer);
         group.Draw(graphics_, instancingBuffer);
     }
     }
     // Priority non-instanced
     // Priority non-instanced
-    for (std::vector<Batch*>::const_iterator i = queue.sortedPriorityBatches_.begin(); i != queue.sortedPriorityBatches_.end(); ++i)
+    for (PODVector<Batch*>::ConstIterator i = queue.sortedPriorityBatches_.Begin(); i != queue.sortedPriorityBatches_.End(); ++i)
     {
     {
         Batch* batch = *i;
         Batch* batch = *i;
         if ((useLightBuffer) && (!batch->light_))
         if ((useLightBuffer) && (!batch->light_))
@@ -2150,10 +2150,10 @@ void View::RenderBatchQueue(const BatchQueue& queue, bool useScissor, bool useLi
     }
     }
     
     
     // Non-priority instanced
     // Non-priority instanced
-    for (std::map<BatchGroupKey, BatchGroup>::const_iterator i = queue.batchGroups_.begin(); i !=
-        queue.batchGroups_.end(); ++i)
+    for (Map<BatchGroupKey, BatchGroup>::ConstIterator i = queue.batchGroups_.Begin(); i !=
+        queue.batchGroups_.End(); ++i)
     {
     {
-        const BatchGroup& group = i->second;
+        const BatchGroup& group = i->second_;
         if ((useScissor) && (group.light_))
         if ((useScissor) && (group.light_))
             OptimizeLightByScissor(group.light_);
             OptimizeLightByScissor(group.light_);
         else
         else
@@ -2163,7 +2163,7 @@ void View::RenderBatchQueue(const BatchQueue& queue, bool useScissor, bool useLi
         group.Draw(graphics_, instancingBuffer);
         group.Draw(graphics_, instancingBuffer);
     }
     }
     // Non-priority non-instanced
     // Non-priority non-instanced
-    for (std::vector<Batch*>::const_iterator i = queue.sortedBatches_.begin(); i != queue.sortedBatches_.end(); ++i)
+    for (PODVector<Batch*>::ConstIterator i = queue.sortedBatches_.Begin(); i != queue.sortedBatches_.End(); ++i)
     {
     {
         Batch* batch = *i;
         Batch* batch = *i;
         // For the transparent queue, both priority and non-priority batches are copied here, so check the flag
         // For the transparent queue, both priority and non-priority batches are copied here, so check the flag
@@ -2187,14 +2187,14 @@ void View::RenderForwardLightBatchQueue(const BatchQueue& queue, Light* light)
     graphics_->SetStencilTest(false);
     graphics_->SetStencilTest(false);
     
     
     // Priority instanced
     // Priority instanced
-    for (std::map<BatchGroupKey, BatchGroup>::const_iterator i = queue.priorityBatchGroups_.begin(); i !=
-        queue.priorityBatchGroups_.end(); ++i)
+    for (Map<BatchGroupKey, BatchGroup>::ConstIterator i = queue.priorityBatchGroups_.Begin(); i !=
+        queue.priorityBatchGroups_.End(); ++i)
     {
     {
-        const BatchGroup& group = i->second;
+        const BatchGroup& group = i->second_;
         group.Draw(graphics_, instancingBuffer);
         group.Draw(graphics_, instancingBuffer);
     }
     }
     // Priority non-instanced
     // Priority non-instanced
-    for (std::vector<Batch*>::const_iterator i = queue.sortedPriorityBatches_.begin(); i != queue.sortedPriorityBatches_.end(); ++i)
+    for (PODVector<Batch*>::ConstIterator i = queue.sortedPriorityBatches_.Begin(); i != queue.sortedPriorityBatches_.End(); ++i)
     {
     {
         Batch* batch = *i;
         Batch* batch = *i;
         batch->Draw(graphics_);
         batch->Draw(graphics_);
@@ -2210,14 +2210,14 @@ void View::RenderForwardLightBatchQueue(const BatchQueue& queue, Light* light)
     }
     }
     
     
     // Non-priority instanced
     // Non-priority instanced
-    for (std::map<BatchGroupKey, BatchGroup>::const_iterator i = queue.batchGroups_.begin(); i !=
-        queue.batchGroups_.end(); ++i)
+    for (Map<BatchGroupKey, BatchGroup>::ConstIterator i = queue.batchGroups_.Begin(); i !=
+        queue.batchGroups_.End(); ++i)
     {
     {
-        const BatchGroup& group = i->second;
+        const BatchGroup& group = i->second_;
         group.Draw(graphics_, instancingBuffer);
         group.Draw(graphics_, instancingBuffer);
     }
     }
     // Non-priority non-instanced
     // Non-priority non-instanced
-    for (std::vector<Batch*>::const_iterator i = queue.sortedBatches_.begin(); i != queue.sortedBatches_.end(); ++i)
+    for (PODVector<Batch*>::ConstIterator i = queue.sortedBatches_.Begin(); i != queue.sortedBatches_.End(); ++i)
     {
     {
         Batch* batch = *i;
         Batch* batch = *i;
         batch->Draw(graphics_);
         batch->Draw(graphics_);

+ 31 - 21
Engine/Graphics/View.h

@@ -44,10 +44,15 @@ struct GeometryDepthBounds
     float max_;
     float max_;
 };
 };
 
 
-
 /// Helper structure for checking whether a transparent object is already lit by a certain light
 /// Helper structure for checking whether a transparent object is already lit by a certain light
 struct LitTransparencyCheck
 struct LitTransparencyCheck
 {
 {
+    /// Construct undefined
+    LitTransparencyCheck()
+    {
+    }
+    
+    /// Construct
     LitTransparencyCheck(Light* light, Drawable* drawable, unsigned batchIndex) :
     LitTransparencyCheck(Light* light, Drawable* drawable, unsigned batchIndex) :
         light_(light),
         light_(light),
         drawable_(drawable),
         drawable_(drawable),
@@ -55,6 +60,11 @@ struct LitTransparencyCheck
     {
     {
     }
     }
     
     
+    /// Test for equality with another lit transparency check
+    bool operator == (const LitTransparencyCheck& rhs) const { return (light_ == rhs.light_) && (drawable_ == rhs.drawable_) && (batchIndex_ == rhs.batchIndex_); }
+    /// Test for inequality with another lit transparency check
+    bool operator != (const LitTransparencyCheck& rhs) const { return (light_ != rhs.light_) || (drawable_ != rhs.drawable_) || (batchIndex_ != rhs.batchIndex_); }
+    
     /// Test if less than another lit transparency check
     /// Test if less than another lit transparency check
     bool operator < (const LitTransparencyCheck& rhs) const
     bool operator < (const LitTransparencyCheck& rhs) const
     {
     {
@@ -117,15 +127,15 @@ 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 std::vector<Drawable*>& GetGeometries() const { return geometries_; }
+    const Vector<Drawable*>& GetGeometries() const { return geometries_; }
     /// Return occluder objects
     /// Return occluder objects
-    const std::vector<Drawable*>& GetOccluders() const { return occluders_; }
+    const Vector<Drawable*>& GetOccluders() const { return occluders_; }
     /// Return directional light shadow rendering occluders
     /// Return directional light shadow rendering occluders
-    const std::vector<Drawable*>& GetShadowOccluders() const { return shadowOccluders_; }
+    const Vector<Drawable*>& GetShadowOccluders() const { return shadowOccluders_; }
     /// Return lights
     /// Return lights
-    const std::vector<Light*>& GetLights() const { return lights_; }
+    const Vector<Light*>& GetLights() const { return lights_; }
     /// Return light batch queues
     /// Return light batch queues
-    const std::vector<LightBatchQueue>& GetLightQueues() const { return lightQueues_; }
+    const Vector<LightBatchQueue>& GetLightQueues() const { return lightQueues_; }
     
     
 private:
 private:
     /// Query the octree for scene nodes
     /// Query the octree for scene nodes
@@ -133,19 +143,19 @@ private:
     /// Construct batches from the scene nodes
     /// Construct batches from the scene nodes
     void GetBatches();
     void GetBatches();
     /// Get lit batches for a certain light and drawable
     /// Get lit batches for a certain light and drawable
-    void GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, LightBatchQueue* lightQueue, std::set<LitTransparencyCheck>& litTransparencies, PassType gBufferPass);
+    void GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, LightBatchQueue* lightQueue, Set<LitTransparencyCheck>& litTransparencies, PassType gBufferPass);
     /// Render batches, forward mode
     /// Render batches, forward mode
     void RenderBatcheforward();
     void RenderBatcheforward();
     /// 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(std::vector<Drawable*>& occluders, Camera* camera);
+    void UpdateOccluders(Vector<Drawable*>& occluders, Camera* camera);
     /// Draw occluders to occlusion buffer
     /// Draw occluders to occlusion buffer
-    void DrawOccluders(OcclusionBuffer* buffer, const std::vector<Drawable*>& occluders);
+    void DrawOccluders(OcclusionBuffer* buffer, const Vector<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 std::vector<Drawable*>& result, BoundingBox& geometryBox, BoundingBox& shadowSpaceBox, bool getLitGeometries, bool GetShadowCasters);
+    void ProcessLightQuery(unsigned splitIndex, const Vector<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
@@ -220,27 +230,27 @@ private:
     /// Combined bounding box of visible geometries in view space
     /// Combined bounding box of visible geometries in view space
     BoundingBox sceneViewBox_;
     BoundingBox sceneViewBox_;
     /// Cache for light scissor queries
     /// Cache for light scissor queries
-    std::map<Light*, Rect> lightScissorCache_;
+    Map<Light*, Rect> lightScissorCache_;
     /// 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
-    std::vector<Drawable*> litGeometries_[MAX_LIGHT_SPLITS];
+    Vector<Drawable*> litGeometries_[MAX_LIGHT_SPLITS];
     /// Current shadow casters being processed
     /// Current shadow casters being processed
-    std::vector<Drawable*> shadowCasters_[MAX_LIGHT_SPLITS];
+    Vector<Drawable*> shadowCasters_[MAX_LIGHT_SPLITS];
     /// Temporary drawable query result
     /// Temporary drawable query result
-    std::vector<Drawable*> tempDrawables_;
+    Vector<Drawable*> tempDrawables_;
     /// Geometry objects
     /// Geometry objects
-    std::vector<Drawable*> geometries_;
+    Vector<Drawable*> geometries_;
     /// Occluder objects
     /// Occluder objects
-    std::vector<Drawable*> occluders_;
+    Vector<Drawable*> occluders_;
     /// Directional light shadow rendering occluders
     /// Directional light shadow rendering occluders
-    std::vector<Drawable*> shadowOccluders_;
+    Vector<Drawable*> shadowOccluders_;
     /// Depth minimum and maximum values for visible geometries
     /// Depth minimum and maximum values for visible geometries
-    std::vector<GeometryDepthBounds> geometryDepthBounds_;
+    Vector<GeometryDepthBounds> geometryDepthBounds_;
     /// Lights
     /// Lights
-    std::vector<Light*> lights_;
+    Vector<Light*> lights_;
     /// G-buffer size error displayed
     /// G-buffer size error displayed
-    std::set<RenderSurface*> gBufferErrorDisplayed_;
+    Set<RenderSurface*> gBufferErrorDisplayed_;
     
     
     /// G-buffer batches
     /// G-buffer batches
     BatchQueue gBufferQueue_;
     BatchQueue gBufferQueue_;
@@ -253,5 +263,5 @@ private:
     /// Unshadowed light volume batches
     /// Unshadowed light volume batches
     BatchQueue noShadowLightQueue_;
     BatchQueue noShadowLightQueue_;
     /// Shadowed light queues
     /// Shadowed light queues
-    std::vector<LightBatchQueue> lightQueues_;
+    Vector<LightBatchQueue> lightQueues_;
 };
 };

+ 9 - 9
Engine/IO/Deserializer.cpp

@@ -261,13 +261,13 @@ ShortStringHash Deserializer::ReadShortStringHash()
     return ret;
     return ret;
 }
 }
 
 
-std::vector<unsigned char> Deserializer::ReadBuffer()
+Vector<unsigned char> Deserializer::ReadBuffer()
 {
 {
-    std::vector<unsigned char> ret;
+    Vector<unsigned char> ret;
     
     
-    ret.resize(ReadVLE());
-    if (ret.size())
-        Read(&ret[0], ret.size());
+    ret.Resize(ReadVLE());
+    if (ret.Size())
+        Read(&ret[0], ret.Size());
     return ret;
     return ret;
 }
 }
 
 
@@ -285,9 +285,9 @@ ResourceRefList Deserializer::ReadResourceRefList()
     ResourceRefList ret;
     ResourceRefList ret;
     
     
     ret.type_ = ReadShortStringHash();
     ret.type_ = ReadShortStringHash();
-    ret.ids_.resize(ReadVLE());
-    if (ret.ids_.size())
-        Read(&ret.ids_[0], ret.ids_.size() * sizeof(StringHash));
+    ret.ids_.Resize(ReadVLE());
+    if (ret.ids_.Size())
+        Read(&ret.ids_[0], ret.ids_.Size() * sizeof(StringHash));
     return ret;
     return ret;
 }
 }
 
 
@@ -356,7 +356,7 @@ VariantVector Deserializer::ReadVariantVector()
     VariantVector ret;
     VariantVector ret;
     
     
     unsigned num = ReadVLE();
     unsigned num = ReadVLE();
-    ret.resize(num);
+    ret.Resize(num);
     for (unsigned i = 0; i < num; ++i)
     for (unsigned i = 0; i < num; ++i)
         ret[i] = ReadVariant();
         ret[i] = ReadVariant();
     
     

+ 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
-    std::vector<unsigned char> ReadBuffer();
+    Vector<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

+ 18 - 17
Engine/IO/FileSystem.cpp

@@ -29,6 +29,7 @@
 #include "SharedArrayPtr.h"
 #include "SharedArrayPtr.h"
 #include "StringUtils.h"
 #include "StringUtils.h"
 
 
+#include <cstdio>
 #include <direct.h>
 #include <direct.h>
 #include <process.h>
 #include <process.h>
 #include <Windows.h>
 #include <Windows.h>
@@ -88,7 +89,7 @@ bool FileSystem::CreateDir(const String& pathName)
 
 
 int FileSystem::SystemCommand(const String& commandLine)
 int FileSystem::SystemCommand(const String& commandLine)
 {
 {
-    if (allowedPaths_.empty())
+    if (allowedPaths_.Empty())
         return system(commandLine.CString());
         return system(commandLine.CString());
     else
     else
     {
     {
@@ -97,17 +98,17 @@ int FileSystem::SystemCommand(const String& commandLine)
     }
     }
 }
 }
 
 
-int FileSystem::SystemRun(const String& fileName, const std::vector<String>& arguments)
+int FileSystem::SystemRun(const String& fileName, const Vector<String>& arguments)
 {
 {
-    if (allowedPaths_.empty())
+    if (allowedPaths_.Empty())
     {
     {
         String fixedFileName = GetNativePath(fileName, true);
         String fixedFileName = GetNativePath(fileName, true);
         
         
-        std::vector<const char*> argPtrs;
-        argPtrs.push_back(fixedFileName.CString());
-        for (unsigned i = 0; i < arguments.size(); ++i)
-            argPtrs.push_back(arguments[i].CString());
-        argPtrs.push_back(0);
+        Vector<const char*> argPtrs;
+        argPtrs.Push(fixedFileName.CString());
+        for (unsigned i = 0; i < arguments.Size(); ++i)
+            argPtrs.Push(arguments[i].CString());
+        argPtrs.Push(0);
         
         
         return _spawnv(_P_WAIT, fixedFileName.CString(), &argPtrs[0]);
         return _spawnv(_P_WAIT, fixedFileName.CString(), &argPtrs[0]);
     }
     }
@@ -120,7 +121,7 @@ int FileSystem::SystemRun(const String& fileName, const std::vector<String>& arg
 
 
 bool FileSystem::SystemOpen(const String& fileName, const String& mode)
 bool FileSystem::SystemOpen(const String& fileName, const String& mode)
 {
 {
-    if (allowedPaths_.empty())
+    if (allowedPaths_.Empty())
     {
     {
         if ((!FileExists(fileName)) && (!DirExists(fileName)))
         if ((!FileExists(fileName)) && (!DirExists(fileName)))
         {
         {
@@ -208,7 +209,7 @@ bool FileSystem::CheckAccess(const String& pathName)
     String fixedPath = AddTrailingSlash(pathName);
     String fixedPath = AddTrailingSlash(pathName);
     
     
     // If no allowed directories defined, succeed always
     // If no allowed directories defined, succeed always
-    if (allowedPaths_.empty())
+    if (allowedPaths_.Empty())
         return true;
         return true;
     
     
     // If there is any attempt to go to a parent directory, disallow
     // If there is any attempt to go to a parent directory, disallow
@@ -216,7 +217,7 @@ bool FileSystem::CheckAccess(const String& pathName)
         return false;
         return false;
     
     
     // Check if the path is a partial match of any of the allowed directories
     // Check if the path is a partial match of any of the allowed directories
-    for (std::set<String>::const_iterator i = allowedPaths_.begin(); i != allowedPaths_.end(); ++i)
+    for (Set<String>::ConstIterator i = allowedPaths_.Begin(); i != allowedPaths_.End(); ++i)
     {
     {
         if (fixedPath.Find(*i) == 0)
         if (fixedPath.Find(*i) == 0)
             return true;
             return true;
@@ -252,9 +253,9 @@ bool FileSystem::DirExists(const String& pathName)
     return true;
     return true;
 }
 }
 
 
-void FileSystem::ScanDir(std::vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive)
+void FileSystem::ScanDir(Vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive)
 {
 {
-    result.clear();
+    result.Clear();
     
     
     if (CheckAccess(pathName))
     if (CheckAccess(pathName))
     {
     {
@@ -292,10 +293,10 @@ void FileSystem::RegisterPath(const String& pathName)
     if (pathName.Empty())
     if (pathName.Empty())
         return;
         return;
     
     
-    allowedPaths_.insert(AddTrailingSlash(pathName));
+    allowedPaths_.Insert(AddTrailingSlash(pathName));
 }
 }
 
 
-void FileSystem::ScanDirInternal(std::vector<String>& result, String path, const String& startPath,
+void FileSystem::ScanDirInternal(Vector<String>& result, String path, const String& startPath,
     const String& filter, unsigned flags, bool recursive)
     const String& filter, unsigned flags, bool recursive)
 {
 {
     path = AddTrailingSlash(path);
     path = AddTrailingSlash(path);
@@ -318,12 +319,12 @@ void FileSystem::ScanDirInternal(std::vector<String>& result, String path, const
                 if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                 if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                 {
                 {
                     if (flags & SCAN_DIRS)
                     if (flags & SCAN_DIRS)
-                        result.push_back(deltaPath + fileName);
+                        result.Push(deltaPath + fileName);
                     if ((recursive) && (fileName != ".") && (fileName != ".."))
                     if ((recursive) && (fileName != ".") && (fileName != ".."))
                         ScanDirInternal(result, path + fileName, startPath, filter, flags, recursive);
                         ScanDirInternal(result, path + fileName, startPath, filter, flags, recursive);
                 }
                 }
                 else if (flags & SCAN_FILES)
                 else if (flags & SCAN_FILES)
-                    result.push_back(deltaPath + fileName);
+                    result.Push(deltaPath + fileName);
             }
             }
         } 
         } 
         while (FindNextFile(handle, &info));
         while (FindNextFile(handle, &info));

+ 6 - 6
Engine/IO/FileSystem.h

@@ -25,8 +25,8 @@
 
 
 #include "Object.h"
 #include "Object.h"
 
 
-#include <set>
-#include <vector>
+#include "Set.h"
+#include "Vector.h"
 
 
 /// Return files
 /// Return files
 static const unsigned SCAN_FILES = 0x1;
 static const unsigned SCAN_FILES = 0x1;
@@ -53,7 +53,7 @@ public:
     /// Run a program using the command interpreter, block until it exits and return the exit code. Will fail if any allowed paths are defined
     /// Run a program using the command interpreter, block until it exits and return the exit code. Will fail if any allowed paths are defined
     int SystemCommand(const String& commandLine);
     int SystemCommand(const String& commandLine);
     /// Run a specific program, block until it exists and return the exit code. Will fail if any allowed paths are defined
     /// Run a specific program, block until it exists and return the exit code. Will fail if any allowed paths are defined
-    int SystemRun(const String& fileName, const std::vector<String>& arguments);
+    int SystemRun(const String& fileName, const Vector<String>& arguments);
     /// Open a file in an external program, with mode such as "edit" optionally specified. Will fail if any allowed paths are defined
     /// Open a file in an external program, with mode such as "edit" optionally specified. Will fail if any allowed paths are defined
     bool SystemOpen(const String& fileName, const String& mode = String());
     bool SystemOpen(const String& fileName, const String& mode = String());
     /// Copy a file. Return true if successful
     /// Copy a file. Return true if successful
@@ -74,7 +74,7 @@ public:
     /// Check if a directory exists
     /// Check if a directory exists
     bool DirExists(const String& pathName);
     bool DirExists(const String& pathName);
     /// Scan a directory for specified files
     /// Scan a directory for specified files
-    void ScanDir(std::vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive);
+    void ScanDir(Vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive);
     /// Return the program's directory
     /// Return the program's directory
     String GetProgramDir();
     String GetProgramDir();
     /// Return the user documents directory
     /// Return the user documents directory
@@ -84,11 +84,11 @@ public:
     
     
 private:
 private:
     /// Scan directory, called internally
     /// Scan directory, called internally
-    void ScanDirInternal(std::vector<String>& result, String path, const String& startPath,
+    void ScanDirInternal(Vector<String>& result, String path, const String& startPath,
         const String& filter, unsigned flags, bool recursive);
         const String& filter, unsigned flags, bool recursive);
     
     
     /// Allowed directories
     /// Allowed directories
-    std::set<String> allowedPaths_;
+    Set<String> allowedPaths_;
 };
 };
 
 
 /// Split a full path to path, filename and extension. The extension will be converted to lowercase
 /// Split a full path to path, filename and extension. The extension will be converted to lowercase

+ 6 - 6
Engine/IO/MemoryBuffer.cpp

@@ -46,16 +46,16 @@ MemoryBuffer::MemoryBuffer(const void* data, unsigned size) :
         size_ = 0;
         size_ = 0;
 }
 }
 
 
-MemoryBuffer::MemoryBuffer(std::vector<unsigned char>& data) :
-    Deserializer(data.size()),
-    buffer_(data.size() ? &data[0] : 0),
+MemoryBuffer::MemoryBuffer(Vector<unsigned char>& data) :
+    Deserializer(data.Size()),
+    buffer_(data.Size() ? &data[0] : 0),
     readOnly_(false)
     readOnly_(false)
 {
 {
 }
 }
 
 
-MemoryBuffer::MemoryBuffer(const std::vector<unsigned char>& data) :
-    Deserializer(data.size()),
-    buffer_(data.size() ? const_cast<unsigned char*>(&data[0]) : 0),
+MemoryBuffer::MemoryBuffer(const Vector<unsigned char>& data) :
+    Deserializer(data.Size()),
+    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(std::vector<unsigned char>& data);
+    MemoryBuffer(Vector<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 std::vector<unsigned char>& data);
+    MemoryBuffer(const Vector<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);

+ 4 - 4
Engine/IO/PackageFile.cpp

@@ -86,14 +86,14 @@ bool PackageFile::Open(const String& fileName)
 
 
 bool PackageFile::Exists(const String& fileName) const
 bool PackageFile::Exists(const String& fileName) const
 {
 {
-    return entries_.find(fileName.ToLower()) != entries_.end();
+    return entries_.Find(fileName.ToLower()) != entries_.End();
 }
 }
 
 
 const PackageEntry* PackageFile::GetEntry(const String& fileName) const
 const PackageEntry* PackageFile::GetEntry(const String& fileName) const
 {
 {
-    std::map<String, PackageEntry>::const_iterator i = entries_.find(fileName.ToLower());
-    if (i == entries_.end())
+    Map<String, PackageEntry>::ConstIterator i = entries_.Find(fileName.ToLower());
+    if (i == entries_.End())
         return 0;
         return 0;
     
     
-    return &i->second;
+    return &i->second_;
 }
 }

+ 3 - 3
Engine/IO/PackageFile.h

@@ -53,13 +53,13 @@ public:
     /// Return the file entry corresponding to the name, or null if not found
     /// Return the file entry corresponding to the name, or null if not found
     const PackageEntry* GetEntry(const String& fileName) const;
     const PackageEntry* GetEntry(const String& fileName) const;
     /// Return all file entries
     /// Return all file entries
-    const std::map<String, PackageEntry>& GetEntries() const { return entries_; }
+    const Map<String, PackageEntry>& GetEntries() const { return entries_; }
     /// Return the package file name
     /// Return the package file name
     const String& GetName() const { return fileName_; }
     const String& GetName() const { return fileName_; }
     /// Return hash of the package file name
     /// Return hash of the package file name
     StringHash GetNameHash() const { return nameHash_; }
     StringHash GetNameHash() const { return nameHash_; }
     /// Return number of files
     /// Return number of files
-    unsigned GetNumFiles() const { return entries_.size(); }
+    unsigned GetNumFiles() const { return entries_.Size(); }
     /// Return total size of the package file
     /// Return total size of the package file
     unsigned GetTotalSize() const { return totalSize_; }
     unsigned GetTotalSize() const { return totalSize_; }
     /// Return checksum of the package file contents
     /// Return checksum of the package file contents
@@ -67,7 +67,7 @@ public:
     
     
 private:
 private:
     /// File entries
     /// File entries
-    std::map<String, PackageEntry> entries_;
+    Map<String, PackageEntry> entries_;
     /// File name
     /// File name
     String fileName_;
     String fileName_;
     /// Package file name hash
     /// Package file name hash

+ 3 - 3
Engine/IO/Precompiled.h

@@ -25,6 +25,6 @@
 
 
 #include "StringBase.h"
 #include "StringBase.h"
 
 
-#include <map>
-#include <set>
-#include <vector>
+#include "Map.h"
+#include "Set.h"
+#include "Vector.h"

+ 10 - 10
Engine/IO/Serializer.cpp

@@ -173,10 +173,10 @@ bool Serializer::WriteShortStringHash(const ShortStringHash& value)
     return WriteUShort(value.GetValue());
     return WriteUShort(value.GetValue());
 }
 }
 
 
-bool Serializer::WriteBuffer(const std::vector<unsigned char>& value)
+bool Serializer::WriteBuffer(const Vector<unsigned char>& value)
 {
 {
     bool success = true;
     bool success = true;
-    unsigned size = value.size();
+    unsigned size = value.Size();
     
     
     success &= WriteVLE(size);
     success &= WriteVLE(size);
     if (size)
     if (size)
@@ -196,10 +196,10 @@ bool Serializer::WriteResourceRef(const ResourceRef& value)
 bool Serializer::WriteResourceRefList(const ResourceRefList& value)
 bool Serializer::WriteResourceRefList(const ResourceRefList& value)
 {
 {
     bool success = true;
     bool success = true;
-    unsigned size = value.ids_.size() * sizeof(StringHash);
+    unsigned size = value.ids_.Size() * sizeof(StringHash);
     
     
     success &= WriteShortStringHash(value.type_);
     success &= WriteShortStringHash(value.type_);
-    success &= WriteVLE(value.ids_.size());
+    success &= WriteVLE(value.ids_.Size());
     if (size)
     if (size)
         success &= Write(&value.ids_[0], size) == size;
         success &= Write(&value.ids_[0], size) == size;
     return success;
     return success;
@@ -275,8 +275,8 @@ bool Serializer::WriteVariantVector(const VariantVector& value)
 {
 {
     bool success = true;
     bool success = true;
     
     
-    success &= WriteVLE(value.size());
-    for (VariantVector::const_iterator i = value.begin(); i != value.end(); ++i)
+    success &= WriteVLE(value.Size());
+    for (VariantVector::ConstIterator i = value.Begin(); i != value.End(); ++i)
         success &= WriteVariant(*i);
         success &= WriteVariant(*i);
     return success;
     return success;
 }
 }
@@ -285,11 +285,11 @@ bool Serializer::WriteVariantMap(const VariantMap& value)
 {
 {
     bool success = true;
     bool success = true;
     
     
-    success &= WriteVLE(value.size());
-    for (VariantMap::const_iterator i = value.begin(); i != value.end(); ++i)
+    success &= WriteVLE(value.Size());
+    for (VariantMap::ConstIterator i = value.Begin(); i != value.End(); ++i)
     {
     {
-        WriteShortStringHash(i->first);
-        WriteVariant(i->second);
+        WriteShortStringHash(i->first_);
+        WriteVariant(i->second_);
     }
     }
     return success;
     return success;
 }
 }

+ 5 - 5
Engine/IO/Serializer.h

@@ -25,8 +25,8 @@
 
 
 #include "StringHash.h"
 #include "StringHash.h"
 
 
-#include <map>
-#include <vector>
+#include "Map.h"
+#include "Vector.h"
 
 
 class Color;
 class Color;
 class IntRect;
 class IntRect;
@@ -40,8 +40,8 @@ class Vector4;
 struct ResourceRef;
 struct ResourceRef;
 struct ResourceRefList;
 struct ResourceRefList;
 
 
-typedef std::vector<Variant> VariantVector;
-typedef std::map<ShortStringHash, Variant> VariantMap;
+typedef Vector<Variant> VariantVector;
+typedef Map<ShortStringHash, Variant> VariantMap;
 
 
 /// Abstract stream for writing
 /// Abstract stream for writing
 class Serializer
 class Serializer
@@ -100,7 +100,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 std::vector<unsigned char>& buffer);
+    bool WriteBuffer(const Vector<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

+ 9 - 9
Engine/IO/VectorBuffer.cpp

@@ -32,7 +32,7 @@ VectorBuffer::VectorBuffer()
 {
 {
 }
 }
 
 
-VectorBuffer::VectorBuffer(const std::vector<unsigned char>& data)
+VectorBuffer::VectorBuffer(const Vector<unsigned char>& data)
 {
 {
     SetData(data);
     SetData(data);
 }
 }
@@ -97,7 +97,7 @@ unsigned VectorBuffer::Write(const void* data, unsigned size)
     if (size + position_ > size_)
     if (size + position_ > size_)
     {
     {
         size_ = size + position_;
         size_ = size + position_;
-        buffer_.resize(size_);
+        buffer_.Resize(size_);
     }
     }
     
     
     unsigned char* srcPtr = (unsigned char*)data;
     unsigned char* srcPtr = (unsigned char*)data;
@@ -124,11 +124,11 @@ unsigned VectorBuffer::Write(const void* data, unsigned size)
     return size;
     return size;
 }
 }
 
 
-void VectorBuffer::SetData(const std::vector<unsigned char>& data)
+void VectorBuffer::SetData(const Vector<unsigned char>& data)
 {
 {
     buffer_ = data;
     buffer_ = data;
     position_ = 0;
     position_ = 0;
-    size_ = data.size();
+    size_ = data.Size();
 }
 }
 
 
 void VectorBuffer::SetData(const void* data, unsigned size)
 void VectorBuffer::SetData(const void* data, unsigned size)
@@ -136,7 +136,7 @@ void VectorBuffer::SetData(const void* data, unsigned size)
     if (!data)
     if (!data)
         size = 0;
         size = 0;
     
     
-    buffer_.resize(size);
+    buffer_.Resize(size);
     if (size)
     if (size)
         memcpy(&buffer_[0], data, size);
         memcpy(&buffer_[0], data, size);
     
     
@@ -146,10 +146,10 @@ void VectorBuffer::SetData(const void* data, unsigned size)
 
 
 void VectorBuffer::SetData(Deserializer& source, unsigned size)
 void VectorBuffer::SetData(Deserializer& source, unsigned size)
 {
 {
-    buffer_.resize(size);
+    buffer_.Resize(size);
     unsigned actualSize = source.Read(&buffer_[0], size);
     unsigned actualSize = source.Read(&buffer_[0], size);
     if (actualSize != size)
     if (actualSize != size)
-        buffer_.resize(actualSize);
+        buffer_.Resize(actualSize);
     
     
     position_ = 0;
     position_ = 0;
     size_ = actualSize;
     size_ = actualSize;
@@ -157,14 +157,14 @@ void VectorBuffer::SetData(Deserializer& source, unsigned size)
 
 
 void VectorBuffer::Clear()
 void VectorBuffer::Clear()
 {
 {
-    buffer_.clear();
+    buffer_.Clear();
     position_ = 0;
     position_ = 0;
     size_ = 0;
     size_ = 0;
 }
 }
 
 
 void VectorBuffer::Resize(unsigned size)
 void VectorBuffer::Resize(unsigned size)
 {
 {
-    buffer_.resize(size);
+    buffer_.Resize(size);
     size_ = size;
     size_ = size;
     if (position_ > size_)
     if (position_ > size_)
         position_ = size_;
         position_ = size_;

+ 5 - 5
Engine/IO/VectorBuffer.h

@@ -26,7 +26,7 @@
 #include "Deserializer.h"
 #include "Deserializer.h"
 #include "Serializer.h"
 #include "Serializer.h"
 
 
-#include <vector>
+#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 +35,7 @@ public:
     /// Construct an empty buffer
     /// Construct an empty buffer
     VectorBuffer();
     VectorBuffer();
     /// Construct from another buffer
     /// Construct from another buffer
-    VectorBuffer(const std::vector<unsigned char>& data);
+    VectorBuffer(const Vector<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 +49,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 std::vector<unsigned char>& data);
+    void SetData(const Vector<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 +64,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 std::vector<unsigned char>& GetBuffer() const { return buffer_; }
+    const Vector<unsigned char>& GetBuffer() const { return buffer_; }
     
     
 private:
 private:
     /// Dynamic sized buffer
     /// Dynamic sized buffer
-    std::vector<unsigned char> buffer_;
+    Vector<unsigned char> buffer_;
 };
 };

+ 50 - 50
Engine/Network/Client.cpp

@@ -105,8 +105,8 @@ void Client::Disconnect()
     if (!scene_)
     if (!scene_)
         scene_->StopAsyncLoading();
         scene_->StopAsyncLoading();
     
     
-    pendingDownloads_.clear();
-    fileTransfers_.clear();
+    pendingDownloads_.Clear();
+    fileTransfers_.Clear();
     sceneInfo_ = SceneInfo();
     sceneInfo_ = SceneInfo();
 }
 }
 
 
@@ -192,10 +192,10 @@ String Client::GetFileTransferStatus() const
 {
 {
     String ret;
     String ret;
     
     
-    for (std::map<StringHash, FileTransfer>::const_iterator i = fileTransfers_.begin(); i != fileTransfers_.end(); ++i)
+    for (Map<StringHash, FileTransfer>::ConstIterator i = fileTransfers_.Begin(); i != fileTransfers_.End(); ++i)
     {
     {
-        String line = i->second.fileName_ + " " + ToString(i->second.bytesReceived_) + "/" + ToString(i->second.size_) 
-            + " (" + ToString((int)(((float)i->second.bytesReceived_ / (float)i->second.size_) * 100.0f + 0.5f)) + "%)\n";
+        String line = i->second_.fileName_ + " " + ToString(i->second_.bytesReceived_) + "/" + ToString(i->second_.size_) 
+            + " (" + ToString((int)(((float)i->second_.bytesReceived_ / (float)i->second_.size_) * 100.0f + 0.5f)) + "%)\n";
         ret += line;
         ret += line;
     }
     }
     
     
@@ -216,8 +216,8 @@ void Client::HandlePeerDisconnected(StringHash eventType, VariantMap& eventData)
         {
         {
             serverConnection_->LeftScene();
             serverConnection_->LeftScene();
             serverConnection_.Reset();
             serverConnection_.Reset();
-            pendingDownloads_.clear();
-            fileTransfers_.clear();
+            pendingDownloads_.Clear();
+            fileTransfers_.Clear();
             sceneInfo_ = SceneInfo();
             sceneInfo_ = SceneInfo();
         }
         }
     }
     }
@@ -228,9 +228,9 @@ void Client::HandleFileTransferCompleted(StringHash eventType, VariantMap& event
     using namespace FileTransferCompleted;
     using namespace FileTransferCompleted;
     
     
     String fileName = eventData[P_FILENAME].GetString();
     String fileName = eventData[P_FILENAME].GetString();
-    if (pendingDownloads_.find(fileName) != pendingDownloads_.end())
+    if (pendingDownloads_.Find(fileName) != pendingDownloads_.End())
     {
     {
-        pendingDownloads_.erase(fileName);
+        pendingDownloads_.Erase(fileName);
         
         
         // Add the package to the resource cache
         // Add the package to the resource cache
         SharedPtr<PackageFile> package(new PackageFile(context_));
         SharedPtr<PackageFile> package(new PackageFile(context_));
@@ -243,7 +243,7 @@ void Client::HandleFileTransferCompleted(StringHash eventType, VariantMap& event
         GetSubsystem<ResourceCache>()->AddPackageFile(package, true);
         GetSubsystem<ResourceCache>()->AddPackageFile(package, true);
         
         
         // If this was the last required download, can now join scene
         // If this was the last required download, can now join scene
-        if ((pendingDownloads_.empty()) && (IsJoinPending()))
+        if ((pendingDownloads_.Empty()) && (IsJoinPending()))
             SetupScene();
             SetupScene();
     }
     }
 }
 }
@@ -253,7 +253,7 @@ void Client::HandleFileTransferFailed(StringHash eventType, VariantMap& eventDat
     using namespace FileTransferFailed;
     using namespace FileTransferFailed;
     
     
     String fileName = eventData[P_FILENAME].GetString();
     String fileName = eventData[P_FILENAME].GetString();
-    if (pendingDownloads_.find(fileName) != pendingDownloads_.end())
+    if (pendingDownloads_.Find(fileName) != pendingDownloads_.End())
         JoinFailed("Failed to transfer file " + fileName);
         JoinFailed("Failed to transfer file " + fileName);
 }
 }
 
 
@@ -336,14 +336,14 @@ void Client::HandleSceneInfo(VectorBuffer& packet)
     // Read source file name & required packages
     // Read source file name & required packages
     sceneInfo_.fileName_ = packet.ReadString();
     sceneInfo_.fileName_ = packet.ReadString();
     unsigned numPackages = packet.ReadVLE();
     unsigned numPackages = packet.ReadVLE();
-    sceneInfo_.requiredPackages_.clear();
+    sceneInfo_.requiredPackages_.Clear();
     for (unsigned i = 0; i < numPackages; ++i)
     for (unsigned i = 0; i < numPackages; ++i)
     {
     {
         PackageInfo package;
         PackageInfo package;
         package.name_ = packet.ReadString();
         package.name_ = packet.ReadString();
         package.size_ = packet.ReadUInt();
         package.size_ = packet.ReadUInt();
         package.checksum_ = packet.ReadUInt();
         package.checksum_ = packet.ReadUInt();
-        sceneInfo_.requiredPackages_.push_back(package);
+        sceneInfo_.requiredPackages_.Push(package);
     }
     }
     
     
     // Check need for downloads: if none, can join immediately
     // Check need for downloads: if none, can join immediately
@@ -354,13 +354,13 @@ void Client::HandleSceneInfo(VectorBuffer& packet)
 void Client::HandleTransferData(VectorBuffer& packet)
 void Client::HandleTransferData(VectorBuffer& packet)
 {
 {
     StringHash nameHash = packet.ReadStringHash();
     StringHash nameHash = packet.ReadStringHash();
-    std::map<StringHash, FileTransfer>::iterator i = fileTransfers_.find(nameHash);
-    if (i == fileTransfers_.end())
+    Map<StringHash, FileTransfer>::Iterator i = fileTransfers_.Find(nameHash);
+    if (i == fileTransfers_.End())
     {
     {
         LOGDEBUG("Received fragment for nonexisting file transfer " + ToString(nameHash));
         LOGDEBUG("Received fragment for nonexisting file transfer " + ToString(nameHash));
         return;
         return;
     }
     }
-    FileTransfer& transfer = i->second;
+    FileTransfer& transfer = i->second_;
     
     
     unsigned index = packet.ReadVLE();
     unsigned index = packet.ReadVLE();
     if (transfer.fragmentsReceived_ != index)
     if (transfer.fragmentsReceived_ != index)
@@ -374,7 +374,7 @@ void Client::HandleTransferData(VectorBuffer& packet)
         eventData[P_REASON] = "Unexpected fragment";
         eventData[P_REASON] = "Unexpected fragment";
         SendEvent(E_FILETRANSFERFAILED, eventData);
         SendEvent(E_FILETRANSFERFAILED, eventData);
         
         
-        fileTransfers_.erase(i);
+        fileTransfers_.Erase(i);
         return;
         return;
     }
     }
     
     
@@ -414,7 +414,7 @@ void Client::HandleTransferData(VectorBuffer& packet)
             SendEvent(E_FILETRANSFERCOMPLETED, eventData);
             SendEvent(E_FILETRANSFERCOMPLETED, eventData);
         }
         }
         
         
-        fileTransfers_.erase(i);
+        fileTransfers_.Erase(i);
         return;
         return;
     }
     }
     
     
@@ -453,7 +453,7 @@ void Client::HandleTransferData(VectorBuffer& packet)
         
         
         VectorBuffer packet;
         VectorBuffer packet;
         packet.WriteUByte(MSG_REQUESTFILE);
         packet.WriteUByte(MSG_REQUESTFILE);
-        packet.WriteStringHash(i->first);
+        packet.WriteStringHash(i->first_);
         packet.WriteVLE(transfer.batchStart_);
         packet.WriteVLE(transfer.batchStart_);
         packet.WriteVLE(transfer.batchSize_);
         packet.WriteVLE(transfer.batchSize_);
         serverConnection_->SendReliable(packet);
         serverConnection_->SendReliable(packet);
@@ -465,8 +465,8 @@ void Client::HandleTransferFailed(VectorBuffer& packet)
     StringHash nameHash = packet.ReadStringHash();
     StringHash nameHash = packet.ReadStringHash();
     String reason = packet.ReadString();
     String reason = packet.ReadString();
     
     
-    std::map<StringHash, FileTransfer>::iterator i = fileTransfers_.find(nameHash);
-    if (i == fileTransfers_.end())
+    Map<StringHash, FileTransfer>::Iterator i = fileTransfers_.Find(nameHash);
+    if (i == fileTransfers_.End())
     {
     {
         LOGDEBUG("Received fail for nonexisting file transfer " + ToString(nameHash));
         LOGDEBUG("Received fail for nonexisting file transfer " + ToString(nameHash));
         return;
         return;
@@ -478,11 +478,11 @@ void Client::HandleTransferFailed(VectorBuffer& packet)
     using namespace FileTransferFailed;
     using namespace FileTransferFailed;
     
     
     VariantMap eventData;
     VariantMap eventData;
-    eventData[P_FILENAME] = i->second.fileName_;
+    eventData[P_FILENAME] = i->second_.fileName_;
     eventData[P_REASON] = reason;
     eventData[P_REASON] = reason;
     SendEvent(E_FILETRANSFERFAILED, eventData);
     SendEvent(E_FILETRANSFERFAILED, eventData);
     
     
-    fileTransfers_.erase(i);
+    fileTransfers_.Erase(i);
 }
 }
 
 
 void Client::HandleJoinReply(VectorBuffer& packet)
 void Client::HandleJoinReply(VectorBuffer& packet)
@@ -504,8 +504,8 @@ void Client::HandleJoinReply(VectorBuffer& packet)
         String reason = packet.ReadString();
         String reason = packet.ReadString();
         
         
         serverConnection_->LeftScene();
         serverConnection_->LeftScene();
-        pendingDownloads_.clear();
-        fileTransfers_.clear();
+        pendingDownloads_.Clear();
+        fileTransfers_.Clear();
         
         
         JoinFailed(reason);
         JoinFailed(reason);
     }
     }
@@ -545,8 +545,8 @@ void Client::HandleServerUpdate(VectorBuffer& packet, bool initial)
     
     
     unsigned short previousEventFrameNumber = serverConnection_->GetEventFrameNumber();
     unsigned short previousEventFrameNumber = serverConnection_->GetEventFrameNumber();
     
     
-    std::set<unsigned> updatedNodes;
-    std::set<unsigned> updatedComponents;
+    Set<unsigned> updatedNodes;
+    Set<unsigned> updatedComponents;
     
     
     // Read the actual scene update messages
     // Read the actual scene update messages
     while (!packet.IsEof())
     while (!packet.IsEof())
@@ -605,33 +605,33 @@ void Client::HandleServerUpdate(VectorBuffer& packet, bool initial)
 
 
 unsigned Client::CheckPackages()
 unsigned Client::CheckPackages()
 {
 {
-    pendingDownloads_.clear();
+    pendingDownloads_.Clear();
     
     
     // To avoid resource version conflicts and to keep the amount of open packages reasonable, remove all existing
     // To avoid resource version conflicts and to keep the amount of open packages reasonable, remove all existing
     // downloaded packages from the resource cache first
     // downloaded packages from the resource cache first
-    std::vector<String> downloadedPackages;
-    std::vector<SharedPtr<PackageFile> > registeredPackages = GetSubsystem<ResourceCache>()->GetPackageFiles();
+    Vector<String> downloadedPackages;
+    Vector<SharedPtr<PackageFile> > registeredPackages = GetSubsystem<ResourceCache>()->GetPackageFiles();
     GetSubsystem<FileSystem>()->ScanDir(downloadedPackages, downloadDirectory_, "*.pak", SCAN_FILES, false);
     GetSubsystem<FileSystem>()->ScanDir(downloadedPackages, downloadDirectory_, "*.pak", SCAN_FILES, false);
     
     
-    for (std::vector<SharedPtr<PackageFile> >::iterator i = registeredPackages.begin(); i != registeredPackages.end();)
+    for (Vector<SharedPtr<PackageFile> >::Iterator i = registeredPackages.Begin(); i != registeredPackages.End();)
     {
     {
         if ((*i)->GetName().Find(downloadDirectory_) != String::NPOS)
         if ((*i)->GetName().Find(downloadDirectory_) != String::NPOS)
         {
         {
             GetSubsystem<ResourceCache>()->RemovePackageFile(*i);
             GetSubsystem<ResourceCache>()->RemovePackageFile(*i);
-            i = registeredPackages.erase(i);
+            i = registeredPackages.Erase(i);
         }
         }
         else
         else
             ++i;
             ++i;
     }
     }
     
     
-    for (unsigned i = 0; i < sceneInfo_.requiredPackages_.size(); ++i)
+    for (unsigned i = 0; i < sceneInfo_.requiredPackages_.Size(); ++i)
     {
     {
         const PackageInfo& required = sceneInfo_.requiredPackages_[i];
         const PackageInfo& required = sceneInfo_.requiredPackages_[i];
         String requiredName = GetFileName(required.name_);
         String requiredName = GetFileName(required.name_);
         bool found = false;
         bool found = false;
         
         
         // Check both already registered packages, and existing downloads
         // Check both already registered packages, and existing downloads
-        for (unsigned j = 0; j < registeredPackages.size(); ++j)
+        for (unsigned j = 0; j < registeredPackages.Size(); ++j)
         {
         {
             PackageFile* package = registeredPackages[i];
             PackageFile* package = registeredPackages[i];
             String name = GetFileName(package->GetName());
             String name = GetFileName(package->GetName());
@@ -645,7 +645,7 @@ unsigned Client::CheckPackages()
         
         
         if (!found)
         if (!found)
         {
         {
-            for (unsigned j = 0; j < downloadedPackages.size(); ++j)
+            for (unsigned j = 0; j < downloadedPackages.Size(); ++j)
             {
             {
                 // Downloaded packages are encoded as filename_checksum.pak, so check if the filename contains the required name
                 // Downloaded packages are encoded as filename_checksum.pak, so check if the filename contains the required name
                 String name = GetFileName(downloadedPackages[i]);
                 String name = GetFileName(downloadedPackages[i]);
@@ -672,17 +672,17 @@ unsigned Client::CheckPackages()
                 JoinFailed("Failed to initiate transfer for file " + required.name_);
                 JoinFailed("Failed to initiate transfer for file " + required.name_);
                 return M_MAX_UNSIGNED; // Return nonzero to prevent immediate join attempt
                 return M_MAX_UNSIGNED; // Return nonzero to prevent immediate join attempt
             }
             }
-            pendingDownloads_.insert(required.name_);
+            pendingDownloads_.Insert(required.name_);
         }
         }
     }
     }
     
     
-    return pendingDownloads_.size();
+    return pendingDownloads_.Size();
 }
 }
 
 
 bool Client::RequestFile(const String& fileName, unsigned size, unsigned checksum)
 bool Client::RequestFile(const String& fileName, unsigned size, unsigned checksum)
 {
 {
     StringHash nameHash(fileName);
     StringHash nameHash(fileName);
-    if (fileTransfers_.find(nameHash) != fileTransfers_.end())
+    if (fileTransfers_.Find(nameHash) != fileTransfers_.End())
         return true; // Already initiated
         return true; // Already initiated
     
     
     FileTransfer newTransfer;
     FileTransfer newTransfer;
@@ -800,8 +800,8 @@ void Client::SendClientUpdate()
     serverConnection_->AddUnackedControls(frameNumber_, controls);
     serverConnection_->AddUnackedControls(frameNumber_, controls);
     
     
     // Append unacked remote events
     // Append unacked remote events
-    const std::vector<RemoteEvent>& unackedEvents = serverConnection_->GetUnackedRemoteEvents();
-    for (std::vector<RemoteEvent>::const_iterator i = unackedEvents.begin(); i != unackedEvents.end(); ++i)
+    const Vector<RemoteEvent>& unackedEvents = serverConnection_->GetUnackedRemoteEvents();
+    for (Vector<RemoteEvent>::ConstIterator i = unackedEvents.Begin(); i != unackedEvents.End(); ++i)
     {
     {
         packet.WriteUByte(i->nodeID_ ? MSG_REMOTENODEEVENT : MSG_REMOTEEVENT);
         packet.WriteUByte(i->nodeID_ ? MSG_REMOTENODEEVENT : MSG_REMOTEEVENT);
         i->Write(packet);
         i->Write(packet);
@@ -810,7 +810,7 @@ void Client::SendClientUpdate()
     serverConnection_->SendUnreliable(packet);
     serverConnection_->SendUnreliable(packet);
 }
 }
 
 
-void Client::ReadNetUpdateBlock(Deserializer& source, unsigned char msgID, std::set<unsigned>& updatedNodes, std::set<unsigned>& updatedComponents)
+void Client::ReadNetUpdateBlock(Deserializer& source, unsigned char msgID, Set<unsigned>& updatedNodes, Set<unsigned>& updatedComponents)
 {
 {
     /*
     /*
     unsigned id = source.ReadUShort();
     unsigned id = source.ReadUShort();
@@ -835,11 +835,11 @@ void Client::ReadNetUpdateBlock(Deserializer& source, unsigned char msgID, std::
             
             
             node->setProperties(source.ReadVariantMap(), true);
             node->setProperties(source.ReadVariantMap(), true);
             
             
-            std::set<Component*> extraComponents;
-            extraComponents.clear();
-            const std::vector<SharedPtr<Component> >& components = node->GetComponents();
-            for (std::vector<SharedPtr<Component> >::const_iterator i = components.begin(); i != components.end(); ++i)
-                extraComponents.insert(*i);
+            Set<Component*> extraComponents;
+            extraComponents.Clear();
+            const Vector<SharedPtr<Component> >& components = node->GetComponents();
+            for (Vector<SharedPtr<Component> >::ConstIterator i = components.Begin(); i != components.End(); ++i)
+                extraComponents.Insert(*i);
             
             
             unsigned nucomponents_ = source.ReadVLE();
             unsigned nucomponents_ = source.ReadVLE();
             for (unsigned i = 0; i < nucomponents_; ++i)
             for (unsigned i = 0; i < nucomponents_; ++i)
@@ -860,14 +860,14 @@ void Client::ReadNetUpdateBlock(Deserializer& source, unsigned char msgID, std::
                 if (newComponent)
                 if (newComponent)
                     component->interpolate(true);
                     component->interpolate(true);
                 
                 
-                extraComponents.erase(component);
+                extraComponents.Erase(component);
             }
             }
             
             
             // Now check if the node has extra components it should not, and remove them
             // Now check if the node has extra components it should not, and remove them
-            for (std::set<Component*>::iterator i = extraComponents.begin(); i != extraComponents.end(); ++i)
+            for (Set<Component*>::Iterator i = extraComponents.Begin(); i != extraComponents.End(); ++i)
                 node->removeComponent(*i);
                 node->removeComponent(*i);
             
             
-            updatedNodes.insert(id);
+            updatedNodes.Insert(id);
         }
         }
         break;
         break;
         
         
@@ -947,7 +947,7 @@ void Client::ReadNetUpdateBlock(Deserializer& source, unsigned char msgID, std::
                     }
                     }
                 }
                 }
             }
             }
-            updatedNodes.insert(id);
+            updatedNodes.Insert(id);
         }
         }
         break;
         break;
     }
     }

Some files were not shown because too many files changed in this diff