Selaa lähdekoodia

Moved SharedPtr & SharedArrayPtr to the Container library.

Lasse Öörni 14 vuotta sitten
vanhempi
sitoutus
aa2491a7ac
43 muutettua tiedostoa jossa 182 lisäystä ja 185 poistoa
  1. 3 3
      Engine/Audio/Audio.cpp
  2. 9 9
      Engine/Audio/Sound.cpp
  3. 1 1
      Engine/Audio/Sound.h
  4. 1 1
      Engine/Audio/SoundSource.cpp
  5. 2 5
      Engine/Container/RefCounted.cpp
  6. 3 3
      Engine/Container/RefCounted.h
  7. 29 29
      Engine/Container/SharedArrayPtr.h
  8. 31 31
      Engine/Container/SharedPtr.h
  9. 5 5
      Engine/Core/Object.cpp
  10. 4 4
      Engine/Engine/APITemplates.h
  11. 1 1
      Engine/Engine/CoreAPI.cpp
  12. 1 1
      Engine/Engine/GraphicsAPI.cpp
  13. 1 1
      Engine/Engine/NetworkAPI.cpp
  14. 3 3
      Engine/Engine/PhysicsAPI.cpp
  15. 1 1
      Engine/Engine/ResourceAPI.cpp
  16. 2 2
      Engine/Engine/SceneAPI.cpp
  17. 3 3
      Engine/Engine/ScriptAPI.cpp
  18. 3 3
      Engine/Engine/UIAPI.cpp
  19. 1 1
      Engine/Graphics/AnimatedModel.cpp
  20. 1 1
      Engine/Graphics/Direct3D9/D3D9IndexBuffer.cpp
  21. 1 1
      Engine/Graphics/Direct3D9/D3D9Shader.cpp
  22. 2 2
      Engine/Graphics/Direct3D9/D3D9ShaderVariation.cpp
  23. 2 2
      Engine/Graphics/Direct3D9/D3D9VertexBuffer.cpp
  24. 3 3
      Engine/Graphics/Geometry.cpp
  25. 4 4
      Engine/Graphics/Model.cpp
  26. 5 5
      Engine/Graphics/OcclusionBuffer.cpp
  27. 2 2
      Engine/IO/FileSystem.cpp
  28. 2 2
      Engine/Network/Client.cpp
  29. 2 2
      Engine/Network/Connection.cpp
  30. 2 2
      Engine/Network/Network.cpp
  31. 7 7
      Engine/Physics/CollisionShape.cpp
  32. 2 2
      Engine/Physics/PhysicsWorld.cpp
  33. 9 9
      Engine/Resource/Image.cpp
  34. 1 1
      Engine/Resource/Resource.cpp
  35. 1 1
      Engine/Resource/Resource.h
  36. 7 7
      Engine/Resource/ResourceCache.cpp
  37. 2 2
      Engine/Resource/XMLFile.cpp
  38. 4 4
      Engine/Scene/Node.cpp
  39. 8 8
      Engine/Script/ScriptFile.cpp
  40. 6 6
      Engine/UI/UI.cpp
  41. 1 1
      Engine/UI/UIElement.cpp
  42. 2 2
      Tools/NormalMapTool/NormalMapTool.cpp
  43. 2 2
      Tools/RampGenerator/RampGenerator.cpp

+ 3 - 3
Engine/Audio/Audio.cpp

@@ -250,15 +250,15 @@ void Audio::MixOutput(void *dest, unsigned mixSamples)
         clipSamples <<= 1;
         clipSamples <<= 1;
     
     
     // Clear clip buffer
     // Clear clip buffer
-    memset(clipBuffer_.GetPtr(), 0, clipSamples * sizeof(int));
-    int* clipPtr = clipBuffer_.GetPtr();
+    memset(clipBuffer_.Ptr(), 0, clipSamples * sizeof(int));
+    int* clipPtr = clipBuffer_.Ptr();
     
     
     // Mix samples to clip buffer
     // Mix samples to clip buffer
     for (PODVector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
     for (PODVector<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
-    clipPtr = clipBuffer_.GetPtr();
+    clipPtr = clipBuffer_.Ptr();
     short* destPtr = (short*)dest;
     short* destPtr = (short*)dest;
     while (clipSamples--)
     while (clipSamples--)
         *destPtr++ = Clamp(*clipPtr++, -32768, 32767);
         *destPtr++ = Clamp(*clipPtr++, -32768, 32767);

+ 9 - 9
Engine/Audio/Sound.cpp

@@ -102,11 +102,11 @@ bool Sound::LoadOggVorbis(Deserializer& source)
 {
 {
     unsigned dataSize = source.GetSize();
     unsigned dataSize = source.GetSize();
     SharedArrayPtr<signed char> data(new signed char[dataSize]);
     SharedArrayPtr<signed char> data(new signed char[dataSize]);
-    source.Read(data.GetPtr(), dataSize);
+    source.Read(data.Ptr(), dataSize);
     
     
     // Check for validity of data
     // Check for validity of data
     int error;
     int error;
-    stb_vorbis* vorbis = stb_vorbis_open_memory((unsigned char*)data.GetPtr(), dataSize, &error, 0);
+    stb_vorbis* vorbis = stb_vorbis_open_memory((unsigned char*)data.Ptr(), dataSize, &error, 0);
     if (!vorbis)
     if (!vorbis)
     {
     {
         LOGERROR("Could not read Ogg Vorbis data from " + source.GetName());
         LOGERROR("Could not read Ogg Vorbis data from " + source.GetName());
@@ -199,7 +199,7 @@ bool Sound::LoadWav(Deserializer& source)
     unsigned length = header.dataLength_;
     unsigned length = header.dataLength_;
     SetSize(length);
     SetSize(length);
     SetFormat(header.frequency_, header.bits_ == 16, header.channels_ == 2);
     SetFormat(header.frequency_, header.bits_ == 16, header.channels_ == 2);
-    source.Read(data_.GetPtr(), length);
+    source.Read(data_.Ptr(), length);
     
     
     // Convert 8-bit audio to signed
     // Convert 8-bit audio to signed
     if (!sixteenBit_)
     if (!sixteenBit_)
@@ -215,7 +215,7 @@ bool Sound::LoadRaw(Deserializer& source)
 {
 {
     unsigned dataSize = source.GetSize();
     unsigned dataSize = source.GetSize();
     SetSize(dataSize);
     SetSize(dataSize);
-    return source.Read(data_.GetPtr(), dataSize) == dataSize;
+    return source.Read(data_.Ptr(), dataSize) == dataSize;
 }
 }
 
 
 void Sound::SetSize(unsigned dataSize)
 void Sound::SetSize(unsigned dataSize)
@@ -237,7 +237,7 @@ void Sound::SetData(const void* data, unsigned dataSize)
         return;
         return;
     
     
     SetSize(dataSize);
     SetSize(dataSize);
-    memcpy(data_.GetPtr(), data, dataSize);
+    memcpy(data_.Ptr(), data, dataSize);
 }
 }
 
 
 void Sound::SetFormat(unsigned frequency, bool sixteenBit, bool stereo)
 void Sound::SetFormat(unsigned frequency, bool sixteenBit, bool stereo)
@@ -256,7 +256,7 @@ void Sound::SetLooped(bool enable)
     {
     {
         if (!compressed_)
         if (!compressed_)
         {
         {
-            end_ = data_.GetPtr() + dataSize_;
+            end_ = data_.Ptr() + dataSize_;
             looped_ = false;
             looped_ = false;
             
             
             FixInterpolation();
             FixInterpolation();
@@ -280,8 +280,8 @@ void Sound::SetLoop(unsigned repeatOffset, unsigned endOffset)
         repeatOffset &= -sampleSize;
         repeatOffset &= -sampleSize;
         endOffset &= -sampleSize;
         endOffset &= -sampleSize;
         
         
-        repeat_ = data_.GetPtr() + repeatOffset;
-        end_ = data_.GetPtr() + endOffset;
+        repeat_ = data_.Ptr() + repeatOffset;
+        end_ = data_.Ptr() + endOffset;
         looped_ = true;
         looped_ = true;
         
         
         FixInterpolation();
         FixInterpolation();
@@ -314,7 +314,7 @@ void* Sound::AllocateDecoder()
         return 0;
         return 0;
     
     
     int error;
     int error;
-    stb_vorbis* vorbis = stb_vorbis_open_memory((unsigned char*)data_.GetPtr(), dataSize_, &error, 0);
+    stb_vorbis* vorbis = stb_vorbis_open_memory((unsigned char*)data_.Ptr(), dataSize_, &error, 0);
     return vorbis;
     return vorbis;
 }
 }
 
 

+ 1 - 1
Engine/Audio/Sound.h

@@ -71,7 +71,7 @@ public:
     void FreeDecoder(void* Decoder);
     void FreeDecoder(void* Decoder);
     
     
     /// Return sound data start
     /// Return sound data start
-    signed char* GetStart() const { return data_.GetPtr(); }
+    signed char* GetStart() const { return data_.Ptr(); }
     /// 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

+ 1 - 1
Engine/Audio/SoundSource.cpp

@@ -275,7 +275,7 @@ void SoundSource::SetAutoRemove(bool enable)
 
 
 bool SoundSource::IsPlaying() const
 bool SoundSource::IsPlaying() const
 {
 {
-    return sound_.GetPtr() != 0;
+    return sound_.Ptr() != 0;
 }
 }
 
 
 void SoundSource::SetPlayPosition(signed char* pos)
 void SoundSource::SetPlayPosition(signed char* pos)

+ 2 - 5
Engine/Core/RefCounted.cpp → Engine/Container/RefCounted.cpp

@@ -21,11 +21,8 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include "Precompiled.h"
 #include "RefCounted.h"
 #include "RefCounted.h"
 
 
-#include "DebugNew.h"
-
 RefCounted::RefCounted() :
 RefCounted::RefCounted() :
     refCount_(new RefCount())
     refCount_(new RefCount())
 {
 {
@@ -59,12 +56,12 @@ void RefCounted::ReleaseRef()
         delete this;
         delete this;
 }
 }
 
 
-unsigned RefCounted::GetRefCount() const
+unsigned RefCounted::Refs() const
 {
 {
     return refCount_->refs_;
     return refCount_->refs_;
 }
 }
 
 
-unsigned RefCounted::GetWeakRefCount() const
+unsigned RefCounted::WeakRefs() const
 {
 {
     // Subtract one to not return the internally held reference
     // Subtract one to not return the internally held reference
     return refCount_->weakRefs_ - 1;
     return refCount_->weakRefs_ - 1;

+ 3 - 3
Engine/Core/RefCounted.h → Engine/Container/RefCounted.h

@@ -56,11 +56,11 @@ public:
     /// Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting
     /// Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting
     void ReleaseRef();
     void ReleaseRef();
     /// Return reference count
     /// Return reference count
-    unsigned GetRefCount() const;
+    unsigned Refs() const;
     /// Return weak reference count
     /// Return weak reference count
-    unsigned GetWeakRefCount() const;
+    unsigned WeakRefs() const;
     /// Return pointer to the reference count structure
     /// Return pointer to the reference count structure
-    RefCount* GetRefCountPtr() { return refCount_; }
+    RefCount* RefCountPtr() { return refCount_; }
 
 
 private:
 private:
     /// Prevent copy construction
     /// Prevent copy construction

+ 29 - 29
Engine/Core/SharedArrayPtr.h → Engine/Container/SharedArrayPtr.h

@@ -122,8 +122,8 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = static_cast<T*>(rhs.GetPtr());
-        refCount_ = rhs.GetRefCountPtr();
+        ptr_ = static_cast<T*>(rhs.Ptr());
+        refCount_ = rhs.RefCountPtr();
         if (refCount_)
         if (refCount_)
             ++(refCount_->refs_);
             ++(refCount_->refs_);
     }
     }
@@ -133,10 +133,10 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = dynamic_cast<T*>(rhs.GetPtr());
+        ptr_ = dynamic_cast<T*>(rhs.Ptr());
         if (ptr_)
         if (ptr_)
         {
         {
-            refCount_ = rhs.GetRefCountPtr();
+            refCount_ = rhs.RefCountPtr();
             if (refCount_)
             if (refCount_)
                 ++(refCount_->refs_);
                 ++(refCount_->refs_);
         }
         }
@@ -145,17 +145,17 @@ public:
     }
     }
     
     
     /// Check if the pointer is null
     /// Check if the pointer is null
-    bool IsNull() const { return ptr_ == 0; }
+    bool Null() const { return ptr_ == 0; }
     /// Check if the pointer is not null
     /// Check if the pointer is not null
     bool NotNull() const { return ptr_ != 0; }
     bool NotNull() const { return ptr_ != 0; }
     /// Return the raw pointer
     /// Return the raw pointer
-    T* GetPtr() const { return ptr_; }
+    T* Ptr() const { return ptr_; }
     /// Return the array's reference count, or 0 if the pointer is null
     /// Return the array's reference count, or 0 if the pointer is null
-    unsigned GetRefCount() const { return refCount_ ? refCount_->refs_ : 0; }
+    unsigned Refs() const { return refCount_ ? refCount_->refs_ : 0; }
     /// Return the array's weak reference count, or 0 if the pointer is null
     /// Return the array's weak reference count, or 0 if the pointer is null
-    unsigned GetWeakRefCount() const { return refCount_ ? refCount_->weakRefs_ : 0; }
+    unsigned WeakRefs() const { return refCount_ ? refCount_->weakRefs_ : 0; }
     /// Return pointer to the RefCount structure
     /// Return pointer to the RefCount structure
-    RefCount* GetRefCountPtr() const { return refCount_; }
+    RefCount* RefCountPtr() const { return refCount_; }
     /// Return hash value for HashSet & HashMap
     /// Return hash value for HashSet & HashMap
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     
     
@@ -221,8 +221,8 @@ public:
     
     
     /// Construct from a shared array pointer
     /// Construct from a shared array pointer
     WeakArrayPtr(const SharedArrayPtr<T>& rhs) :
     WeakArrayPtr(const SharedArrayPtr<T>& rhs) :
-        ptr_(rhs.GetPtr()),
-        refCount_(rhs.GetRefCountPtr())
+        ptr_(rhs.Ptr()),
+        refCount_(rhs.RefCountPtr())
     {
     {
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
@@ -246,13 +246,13 @@ public:
     /// Assign from a shared array pointer
     /// Assign from a shared array pointer
     WeakArrayPtr<T>& operator = (const SharedArrayPtr<T>& rhs)
     WeakArrayPtr<T>& operator = (const SharedArrayPtr<T>& rhs)
     {
     {
-        if (ptr_ == rhs.GetPtr() && refCount_ == rhs.GetRefCountPtr())
+        if (ptr_ == rhs.Ptr() && refCount_ == rhs.RefCountPtr())
             return *this;
             return *this;
         
         
         Release();
         Release();
         
         
-        ptr_ = rhs.GetPtr();
-        refCount_ = rhs.GetRefCountPtr();
+        ptr_ = rhs.Ptr();
+        refCount_ = rhs.RefCountPtr();
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
         
         
@@ -278,16 +278,16 @@ public:
     /// Convert to shared array pointer. If expired, return a null shared array pointer
     /// Convert to shared array pointer. If expired, return a null shared array pointer
     SharedArrayPtr<T> ToShared() const
     SharedArrayPtr<T> ToShared() const
     {
     {
-        if (IsExpired())
+        if (Expired())
             return SharedArrayPtr<T>();
             return SharedArrayPtr<T>();
         else
         else
             return SharedArrayPtr<T>(ptr_, refCount_);
             return SharedArrayPtr<T>(ptr_, refCount_);
     }
     }
     
     
     /// Return raw pointer. If expired, return null
     /// Return raw pointer. If expired, return null
-    T* GetPtr() const
+    T* Ptr() const
     {
     {
-        if (IsExpired())
+        if (Expired())
             return 0;
             return 0;
         else
         else
             return ptr_;
             return ptr_;
@@ -296,19 +296,19 @@ public:
     /// Point to the array
     /// Point to the array
     T* operator -> () const
     T* operator -> () const
     {
     {
-        return GetPtr();
+        return Ptr();
     }
     }
     
     
     /// Dereference the array
     /// Dereference the array
     T& operator * () const
     T& operator * () const
     {
     {
-        return *GetPtr();
+        return *Ptr();
     }
     }
     
     
     /// Subscript the array
     /// Subscript the array
     T& operator [] (const int index)
     T& operator [] (const int index)
     {
     {
-        return (*GetPtr())[index];
+        return (*Ptr())[index];
     }
     }
     
     
     /// Test for equality with another weak array pointer
     /// Test for equality with another weak array pointer
@@ -318,9 +318,9 @@ public:
     /// Test for less than with another weak array pointer
     /// Test for less than with another weak array pointer
     bool operator < (const WeakArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     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 !Expired(); }
     /// Convert to a raw pointer, null if array is expired
     /// Convert to a raw pointer, null if array is expired
-    operator T* () const { return GetPtr(); }
+    operator T* () const { return Ptr(); }
     
     
     /// Reset to null and release the weak reference
     /// Reset to null and release the weak reference
     void Reset()
     void Reset()
@@ -333,7 +333,7 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = static_cast<T*>(rhs.GetPtr());
+        ptr_ = static_cast<T*>(rhs.Ptr());
         refCount_ = rhs.refCount_;
         refCount_ = rhs.refCount_;
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
@@ -344,7 +344,7 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = dynamic_cast<T*>(rhs.GetPtr());
+        ptr_ = dynamic_cast<T*>(rhs.Ptr());
         if (ptr_)
         if (ptr_)
         {
         {
             refCount_ = rhs.refCount_;
             refCount_ = rhs.refCount_;
@@ -356,17 +356,17 @@ public:
     }
     }
     
     
     /// Check if the pointer is null
     /// Check if the pointer is null
-    bool IsNull() const { return refCount_ == 0; }
+    bool Null() const { return refCount_ == 0; }
     /// Check if the pointer is not null
     /// Check if the pointer is not null
     bool NotNull() const { return refCount_ != 0; }
     bool NotNull() const { return refCount_ != 0; }
     /// Return the array's reference count, or 0 if null pointer or if array is expired
     /// Return the array's reference count, or 0 if null pointer or if array is expired
-    unsigned GetRefCount() const { return refCount_ ? refCount_->refs_ : 0; }
+    unsigned Refs() const { return refCount_ ? refCount_->refs_ : 0; }
     /// Return the array's weak reference count
     /// Return the array's weak reference count
-    unsigned GetWeakRefCount() const { return refCount_ ? refCount_->weakRefs_ : 0; }
+    unsigned WeakRefs() const { return refCount_ ? refCount_->weakRefs_ : 0; }
     /// Return whether the array has expired. If null pointer, always return true
     /// Return whether the array has expired. If null pointer, always return true
-    bool IsExpired() const { return refCount_ ? refCount_->expired_ : true; }
+    bool Expired() const { return refCount_ ? refCount_->expired_ : true; }
     /// Return pointer to RefCount structure
     /// Return pointer to RefCount structure
-    RefCount* GetRefCountPtr() const { return refCount_; }
+    RefCount* RefCountPtr() const { return refCount_; }
     /// Return hash value for HashSet & HashMap
     /// Return hash value for HashSet & HashMap
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     
     

+ 31 - 31
Engine/Core/SharedPtr.h → Engine/Container/SharedPtr.h

@@ -115,7 +115,7 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = static_cast<T*>(rhs.GetPtr());
+        ptr_ = static_cast<T*>(rhs.Ptr());
         if (ptr_)
         if (ptr_)
             ptr_->AddRef();
             ptr_->AddRef();
     }
     }
@@ -125,23 +125,23 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = dynamic_cast<T*>(rhs.GetPtr());
+        ptr_ = dynamic_cast<T*>(rhs.Ptr());
         if (ptr_)
         if (ptr_)
             ptr_->AddRef();
             ptr_->AddRef();
     }
     }
     
     
     /// Check if the pointer is null
     /// Check if the pointer is null
-    bool IsNull() const { return ptr_ == 0; }
+    bool Null() const { return ptr_ == 0; }
     /// Check if the pointer is not null
     /// Check if the pointer is not null
     bool NotNull() const { return ptr_ != 0; }
     bool NotNull() const { return ptr_ != 0; }
     /// Return the raw pointer
     /// Return the raw pointer
-    T* GetPtr() const { return ptr_; }
+    T* Ptr() const { return ptr_; }
     /// Return the object's reference count, or 0 if the pointer is null
     /// Return the object's reference count, or 0 if the pointer is null
-    unsigned GetRefCount() const { return ptr_ ? ptr_->GetRefCount() : 0; }
+    unsigned Refs() const { return ptr_ ? ptr_->Refs() : 0; }
     /// Return the object's weak reference count, or 0 if the pointer is null
     /// Return the object's weak reference count, or 0 if the pointer is null
-    unsigned GetWeakRefCount() const { return ptr_ ? ptr_->GetWeakRefCount() : 0; }
+    unsigned WeakRefs() const { return ptr_ ? ptr_->WeakRefs() : 0; }
     /// Return pointer to the RefCount structure
     /// Return pointer to the RefCount structure
-    RefCount* GetRefCountPtr() const { return ptr_ ? ptr_->GetRefCountPtr() : 0; }
+    RefCount* RefCountPtr() const { return ptr_ ? ptr_->RefCountPtr() : 0; }
     /// Return hash value for HashSet & HashMap
     /// Return hash value for HashSet & HashMap
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     
     
@@ -192,8 +192,8 @@ public:
     
     
     /// Construct from a shared pointer
     /// Construct from a shared pointer
     WeakPtr(const SharedPtr<T>& rhs) :
     WeakPtr(const SharedPtr<T>& rhs) :
-        ptr_(rhs.GetPtr()),
-        refCount_(rhs.GetRefCountPtr())
+        ptr_(rhs.Ptr()),
+        refCount_(rhs.RefCountPtr())
     {
     {
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
@@ -211,7 +211,7 @@ public:
     /// Construct from a raw pointer
     /// Construct from a raw pointer
     explicit WeakPtr(T* ptr) :
     explicit WeakPtr(T* ptr) :
         ptr_(ptr),
         ptr_(ptr),
-        refCount_(ptr ? ptr->GetRefCountPtr() : 0)
+        refCount_(ptr ? ptr->RefCountPtr() : 0)
     {
     {
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
@@ -226,13 +226,13 @@ public:
     /// Assign from a shared pointer
     /// Assign from a shared pointer
     WeakPtr<T>& operator = (const SharedPtr<T>& rhs)
     WeakPtr<T>& operator = (const SharedPtr<T>& rhs)
     {
     {
-        if (ptr_ == rhs.GetPtr() && refCount_ == rhs.GetRefCountPtr())
+        if (ptr_ == rhs.Ptr() && refCount_ == rhs.RefCountPtr())
             return *this;
             return *this;
         
         
         Release();
         Release();
         
         
-        ptr_ = rhs.GetPtr();
-        refCount_ = rhs.GetRefCountPtr();
+        ptr_ = rhs.Ptr();
+        refCount_ = rhs.RefCountPtr();
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
         
         
@@ -258,7 +258,7 @@ public:
     /// Assign from a raw pointer
     /// Assign from a raw pointer
     WeakPtr<T>& operator = (T* ptr)
     WeakPtr<T>& operator = (T* ptr)
     {
     {
-        RefCount* refCount = ptr ? ptr->GetRefCountPtr() : 0;
+        RefCount* refCount = ptr ? ptr->RefCountPtr() : 0;
         
         
         if (ptr_ == ptr && refCount_ == refCount)
         if (ptr_ == ptr && refCount_ == refCount)
             return *this;
             return *this;
@@ -276,16 +276,16 @@ public:
     /// Convert to a shared pointer. If expired, return a null shared pointer
     /// Convert to a shared pointer. If expired, return a null shared pointer
     SharedPtr<T> ToShared() const
     SharedPtr<T> ToShared() const
     {
     {
-        if (IsExpired())
+        if (Expired())
             return SharedPtr<T>();
             return SharedPtr<T>();
         else
         else
             return SharedPtr<T>(ptr_);
             return SharedPtr<T>(ptr_);
     }
     }
     
     
     /// Return raw pointer. If expired, return null
     /// Return raw pointer. If expired, return null
-    T* GetPtr() const
+    T* Ptr() const
     {
     {
-        if (IsExpired())
+        if (Expired())
             return 0;
             return 0;
         else
         else
             return ptr_;
             return ptr_;
@@ -294,19 +294,19 @@ public:
     /// Point to the object
     /// Point to the object
     T* operator -> () const
     T* operator -> () const
     {
     {
-        return GetPtr();
+        return Ptr();
     }
     }
     
     
     /// Dereference the object
     /// Dereference the object
     T& operator * () const
     T& operator * () const
     {
     {
-        return *GetPtr();
+        return *Ptr();
     }
     }
     
     
     /// Subscript the object if applicable
     /// Subscript the object if applicable
     T& operator [] (const int index)
     T& operator [] (const int index)
     {
     {
-        return (*GetPtr())[index];
+        return (*Ptr())[index];
     }
     }
     
     
     /// Test for equality with another weak pointer
     /// Test for equality with another weak pointer
@@ -316,9 +316,9 @@ public:
     /// Test for less than with another weak pointer
     /// Test for less than with another weak pointer
     bool operator < (const SharedPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     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 !Expired(); }
     /// Convert to a raw pointer, null if the object is expired
     /// Convert to a raw pointer, null if the object is expired
-    operator T* () const { return GetPtr(); }
+    operator T* () const { return Ptr(); }
     
     
     /// Reset to null and release the weak reference
     /// Reset to null and release the weak reference
     void Reset()
     void Reset()
@@ -331,7 +331,7 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = static_cast<T*>(rhs.GetPtr());
+        ptr_ = static_cast<T*>(rhs.Ptr());
         refCount_ = rhs.refCount_;
         refCount_ = rhs.refCount_;
         if (refCount_)
         if (refCount_)
             ++(refCount_->weakRefs_);
             ++(refCount_->weakRefs_);
@@ -342,7 +342,7 @@ public:
     {
     {
         Release();
         Release();
         
         
-        ptr_ = dynamic_cast<T*>(rhs.GetPtr());
+        ptr_ = dynamic_cast<T*>(rhs.Ptr());
         if (ptr_)
         if (ptr_)
         {
         {
             refCount_ = rhs.refCount_;
             refCount_ = rhs.refCount_;
@@ -354,25 +354,25 @@ public:
     }
     }
     
     
     /// Check if the pointer is null
     /// Check if the pointer is null
-    bool IsNull() const { return refCount_ == 0; }
+    bool Null() const { return refCount_ == 0; }
     /// Check if the pointer is not null. It does not matter whether the object has expired or not
     /// Check if the pointer is not null. It does not matter whether the object has expired or not
     bool NotNull() const { return refCount_ != 0; }
     bool NotNull() const { return refCount_ != 0; }
     /// Return the object's reference count, or 0 if null pointer or if object is expired
     /// Return the object's reference count, or 0 if null pointer or if object is expired
-    unsigned GetRefCount() const { return refCount_ ? refCount_->refs_ : 0; }
+    unsigned Refs() const { return refCount_ ? refCount_->refs_ : 0; }
     
     
     /// Return the object's weak reference count
     /// Return the object's weak reference count
-    unsigned GetWeakRefCount() const
+    unsigned WeakRefs() const
     {
     {
-        if (!IsExpired())
-            return ptr_->GetWeakRefCount();
+        if (!Expired())
+            return ptr_->WeakRefs();
         
         
         return refCount_ ? refCount_->weakRefs_ : 0;
         return refCount_ ? refCount_->weakRefs_ : 0;
     }
     }
     
     
     /// Return whether the object has expired. If null pointer, always return true
     /// Return whether the object has expired. If null pointer, always return true
-    bool IsExpired() const { return refCount_ ? refCount_->expired_ : true; }
+    bool Expired() const { return refCount_ ? refCount_->expired_ : true; }
     /// Return pointer to the RefCount structure
     /// Return pointer to the RefCount structure
-    RefCount* GetRefCountPtr() const { return refCount_; }
+    RefCount* RefCountPtr() const { return refCount_; }
     /// Return hash value for HashSet & HashMap
     /// Return hash value for HashSet & HashMap
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     unsigned ToHash() const { return ((unsigned)ptr_) / sizeof(T); }
     
     

+ 5 - 5
Engine/Core/Object.cpp

@@ -51,7 +51,7 @@ void Object::OnEvent(Object* sender, bool broadcast, StringHash eventType, Varia
     {
     {
         context_->SetEventHandler(i->second_);
         context_->SetEventHandler(i->second_);
         i->second_->Invoke(eventType, eventData);
         i->second_->Invoke(eventType, eventData);
-        if (!self.IsExpired())
+        if (!self.Expired())
             context_->SetEventHandler(0);
             context_->SetEventHandler(0);
         return;
         return;
     }
     }
@@ -62,7 +62,7 @@ void Object::OnEvent(Object* sender, bool broadcast, StringHash eventType, Varia
     {
     {
         context_->SetEventHandler(i->second_);
         context_->SetEventHandler(i->second_);
         i->second_->Invoke(eventType, eventData);
         i->second_->Invoke(eventType, eventData);
-        if (!self.IsExpired())
+        if (!self.Expired())
             context_->SetEventHandler(0);
             context_->SetEventHandler(0);
     }
     }
 }
 }
@@ -194,7 +194,7 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
             {
             {
                 processed.Insert(receiver);
                 processed.Insert(receiver);
                 receiver->OnEvent(this, true, eventType, eventData);
                 receiver->OnEvent(this, true, eventType, eventData);
-                if (self.IsExpired())
+                if (self.Expired())
                 {
                 {
                     context_->EndSendEvent();
                     context_->EndSendEvent();
                     return;
                     return;
@@ -216,7 +216,7 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
                 if (receiver)
                 if (receiver)
                 {
                 {
                     receiver->OnEvent(this, true, eventType, eventData);
                     receiver->OnEvent(this, true, eventType, eventData);
-                    if (self.IsExpired())
+                    if (self.Expired())
                     {
                     {
                         context_->EndSendEvent();
                         context_->EndSendEvent();
                         return;
                         return;
@@ -233,7 +233,7 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
                 if (receiver && processed.Find(receiver) == processed.End())
                 if (receiver && processed.Find(receiver) == processed.End())
                 {
                 {
                     receiver->OnEvent(this, true, eventType, eventData);
                     receiver->OnEvent(this, true, eventType, eventData);
-                    if (self.IsExpired())
+                    if (self.Expired())
                     {
                     {
                         context_->EndSendEvent();
                         context_->EndSendEvent();
                         return;
                         return;

+ 4 - 4
Engine/Engine/APITemplates.h

@@ -153,9 +153,9 @@ template <class T> CScriptArray* SharedPtrVectorToHandleArray(const Vector<Share
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         for (unsigned i = 0; i < arr->GetSize(); ++i)
         {
         {
             // Increment reference count for storing in the array
             // Increment reference count for storing in the array
-            if (vector[i].GetPtr())
+            if (vector[i].Ptr())
                 vector[i]->AddRef();
                 vector[i]->AddRef();
-            *(static_cast<T**>(arr->At(i))) = vector[i].GetPtr();
+            *(static_cast<T**>(arr->At(i))) = vector[i].Ptr();
         }
         }
         
         
         return arr;
         return arr;
@@ -442,7 +442,7 @@ static Node* NodeGetChild(unsigned index, Node* ptr)
         return 0;
         return 0;
     }
     }
     else
     else
-        return children[index].GetPtr();
+        return children[index].Ptr();
 }
 }
 
 
 static CScriptArray* NodeGetScriptedChildren(bool recursive, Node* ptr)
 static CScriptArray* NodeGetScriptedChildren(bool recursive, Node* ptr)
@@ -466,7 +466,7 @@ static CScriptArray* NodeGetScriptedChildrenWithClassName(const String& classNam
         {
         {
             if ((*j)->GetType() == ScriptInstance::GetTypeStatic())
             if ((*j)->GetType() == ScriptInstance::GetTypeStatic())
             {
             {
-                ScriptInstance* instance = static_cast<ScriptInstance*>(j->GetPtr());
+                ScriptInstance* instance = static_cast<ScriptInstance*>(j->Ptr());
                 if (instance->GetClassName() == className)
                 if (instance->GetClassName() == className)
                     ret.Push(node);
                     ret.Push(node);
             }
             }

+ 1 - 1
Engine/Engine/CoreAPI.cpp

@@ -613,7 +613,7 @@ void RegisterObject(asIScriptEngine* engine)
     engine->RegisterGlobalFunction("void UnsubscribeFromEvents(Object@+)", asFUNCTION(UnsubscribeFromSenderEvents), asCALL_CDECL);
     engine->RegisterGlobalFunction("void UnsubscribeFromEvents(Object@+)", asFUNCTION(UnsubscribeFromSenderEvents), asCALL_CDECL);
     engine->RegisterGlobalFunction("void UnsubscribeFromAllEvents()", asFUNCTION(UnsubscribeFromAllEvents), asCALL_CDECL);
     engine->RegisterGlobalFunction("void UnsubscribeFromAllEvents()", asFUNCTION(UnsubscribeFromAllEvents), asCALL_CDECL);
     
     
-    engine->RegisterGlobalFunction("Object@+ get_Sender()", asFUNCTION(GetSender), asCALL_CDECL);
+    engine->RegisterGlobalFunction("Object@+ get_sender()", asFUNCTION(GetSender), asCALL_CDECL);
 }
 }
 
 
 void RegisterCoreAPI(asIScriptEngine* engine)
 void RegisterCoreAPI(asIScriptEngine* engine)

+ 1 - 1
Engine/Engine/GraphicsAPI.cpp

@@ -257,7 +257,7 @@ static Material* MaterialClone(const String& cloneName, Material* ptr)
     // The shared pointer will go out of scope, so have to increment the reference count
     // The shared pointer will go out of scope, so have to increment the reference count
     // (here an auto handle can not be used)
     // (here an auto handle can not be used)
     clonedMaterial->AddRef();
     clonedMaterial->AddRef();
-    return clonedMaterial.GetPtr();
+    return clonedMaterial.Ptr();
 }
 }
 
 
 static void RegisterMaterial(asIScriptEngine* engine)
 static void RegisterMaterial(asIScriptEngine* engine)

+ 1 - 1
Engine/Engine/NetworkAPI.cpp

@@ -90,7 +90,7 @@ void RegisterPeer(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Peer", "const String& get_address() const", asMETHOD(Peer, GetAddress), asCALL_THISCALL);
     engine->RegisterObjectMethod("Peer", "const String& get_address() const", asMETHOD(Peer, GetAddress), asCALL_THISCALL);
     engine->RegisterObjectMethod("Peer", "uint16 get_port() const", asMETHOD(Peer, GetPort), asCALL_THISCALL);
     engine->RegisterObjectMethod("Peer", "uint16 get_port() const", asMETHOD(Peer, GetPort), asCALL_THISCALL);
     
     
-    // Register Variant GetPtr() for Peer
+    // Register Variant Ptr() for Peer
     engine->RegisterObjectMethod("Variant", "Peer@+ GetPeer() const", asFUNCTION(GetVariantPtr<Peer>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "Peer@+ GetPeer() const", asFUNCTION(GetVariantPtr<Peer>), asCALL_CDECL_OBJLAST);
 }
 }
 
 

+ 3 - 3
Engine/Engine/PhysicsAPI.cpp

@@ -102,7 +102,7 @@ static void RegisterPhysicsWorld(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Scene", "PhysicsWorld@+ get_physicsWorld() const", asFUNCTION(SceneGetPhysicsWorld), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Scene", "PhysicsWorld@+ get_physicsWorld() const", asFUNCTION(SceneGetPhysicsWorld), asCALL_CDECL_OBJLAST);
     engine->RegisterGlobalFunction("PhysicsWorld@+ get_physicsWorld()", asFUNCTION(GetPhysicsWorld), asCALL_CDECL);
     engine->RegisterGlobalFunction("PhysicsWorld@+ get_physicsWorld()", asFUNCTION(GetPhysicsWorld), asCALL_CDECL);
     
     
-    // Register Variant GetPtr() for PhysicsWorld
+    // Register Variant Ptr() for PhysicsWorld
     engine->RegisterObjectMethod("Variant", "PhysicsWorld@+ GetPhysicsWorld() const", asFUNCTION(GetVariantPtr<PhysicsWorld>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "PhysicsWorld@+ GetPhysicsWorld() const", asFUNCTION(GetVariantPtr<PhysicsWorld>), asCALL_CDECL_OBJLAST);
 }
 }
 
 
@@ -143,7 +143,7 @@ static void RegisterCollisionShape(asIScriptEngine* engine)
     engine->RegisterObjectMethod("CollisionShape", "void set_bounce(float)", asMETHOD(CollisionShape, SetBounce), asCALL_THISCALL);
     engine->RegisterObjectMethod("CollisionShape", "void set_bounce(float)", asMETHOD(CollisionShape, SetBounce), asCALL_THISCALL);
     engine->RegisterObjectMethod("CollisionShape", "float get_bounce()", asMETHOD(CollisionShape, GetBounce), asCALL_THISCALL);
     engine->RegisterObjectMethod("CollisionShape", "float get_bounce()", asMETHOD(CollisionShape, GetBounce), asCALL_THISCALL);
     
     
-    // Register Variant GetPtr() for CollisionShape
+    // Register Variant Ptr() for CollisionShape
     engine->RegisterObjectMethod("Variant", "CollisionShape@+ GetCollisionShape() const", asFUNCTION(GetVariantPtr<CollisionShape>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "CollisionShape@+ GetCollisionShape() const", asFUNCTION(GetVariantPtr<CollisionShape>), asCALL_CDECL_OBJLAST);
 }
 }
 
 
@@ -182,7 +182,7 @@ static void RegisterRigidBody(asIScriptEngine* engine)
     engine->RegisterObjectMethod("RigidBody", "void set_angularDampingScale(float)", asMETHOD(RigidBody, SetAngularDampingScale), asCALL_THISCALL);
     engine->RegisterObjectMethod("RigidBody", "void set_angularDampingScale(float)", asMETHOD(RigidBody, SetAngularDampingScale), asCALL_THISCALL);
     engine->RegisterObjectMethod("RigidBody", "float get_angularDampingScale() const", asMETHOD(RigidBody, GetAngularDampingScale), asCALL_THISCALL);
     engine->RegisterObjectMethod("RigidBody", "float get_angularDampingScale() const", asMETHOD(RigidBody, GetAngularDampingScale), asCALL_THISCALL);
     
     
-    // Register Variant GetPtr() for RigidBody
+    // Register Variant Ptr() for RigidBody
     engine->RegisterObjectMethod("Variant", "RigidBody@+ GetRigidBody() const", asFUNCTION(GetVariantPtr<RigidBody>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "RigidBody@+ GetRigidBody() const", asFUNCTION(GetVariantPtr<RigidBody>), asCALL_CDECL_OBJLAST);
 }
 }
 
 

+ 1 - 1
Engine/Engine/ResourceAPI.cpp

@@ -44,7 +44,7 @@ static File* ResourceCacheGetFile(const String& name, ResourceCache* ptr)
     // (here an auto handle can not be used)
     // (here an auto handle can not be used)
     if (file)
     if (file)
         file->AddRef();
         file->AddRef();
-    return file.GetPtr();
+    return file.Ptr();
 }
 }
 
 
 static void ResourceCacheReleaseResource(const String& type, const String& name, bool force, ResourceCache* ptr)
 static void ResourceCacheReleaseResource(const String& type, const String& name, bool force, ResourceCache* ptr)

+ 2 - 2
Engine/Engine/SceneAPI.cpp

@@ -47,7 +47,7 @@ static void RegisterNode(asIScriptEngine* engine)
     // Now GetNode can be registered
     // Now GetNode can be registered
     engine->RegisterObjectMethod("Component", "Node@+ get_node() const", asMETHOD(Component, GetNode), asCALL_THISCALL);
     engine->RegisterObjectMethod("Component", "Node@+ get_node() const", asMETHOD(Component, GetNode), asCALL_THISCALL);
     
     
-    // Register Variant GetPtr() for Node & Component
+    // Register Variant Ptr() for Node & Component
     engine->RegisterObjectMethod("Variant", "Node@+ GetNode() const", asFUNCTION(GetVariantPtr<Node>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "Node@+ GetNode() const", asFUNCTION(GetVariantPtr<Node>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "Component@+ GetComponent() const", asFUNCTION(GetVariantPtr<Component>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "Component@+ GetComponent() const", asFUNCTION(GetVariantPtr<Component>), asCALL_CDECL_OBJLAST);
 }
 }
@@ -112,7 +112,7 @@ static void RegisterScene(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Node", "Scene@+ get_scene() const", asMETHOD(Node, GetScene), asCALL_THISCALL);
     engine->RegisterObjectMethod("Node", "Scene@+ get_scene() const", asMETHOD(Node, GetScene), asCALL_THISCALL);
     engine->RegisterGlobalFunction("Scene@+ get_scene()", asFUNCTION(GetScriptContextScene), asCALL_CDECL);
     engine->RegisterGlobalFunction("Scene@+ get_scene()", asFUNCTION(GetScriptContextScene), asCALL_CDECL);
     
     
-    // Register Variant GetPtr() for Scene
+    // Register Variant Ptr() for Scene
     engine->RegisterObjectMethod("Variant", "Scene@+ GetScene() const", asFUNCTION(GetVariantPtr<Scene>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "Scene@+ GetScene() const", asFUNCTION(GetVariantPtr<Scene>), asCALL_CDECL_OBJLAST);
 }
 }
 
 

+ 3 - 3
Engine/Engine/ScriptAPI.cpp

@@ -54,7 +54,7 @@ static asIScriptObject* NodeCreateScriptObjectWithFile(ScriptFile* file, const S
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->GetPtr());
+            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Ptr());
             asIScriptObject* object = instance->GetScriptObject();
             asIScriptObject* object = instance->GetScriptObject();
             if (!object)
             if (!object)
             {
             {
@@ -91,7 +91,7 @@ asIScriptObject* NodeGetScriptObject(Node* ptr)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->GetPtr());
+            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Ptr());
             asIScriptObject* object = instance->GetScriptObject();
             asIScriptObject* object = instance->GetScriptObject();
             if (object)
             if (object)
                 return object;
                 return object;
@@ -108,7 +108,7 @@ asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->GetPtr());
+            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Ptr());
             if (instance->GetClassName() == className)
             if (instance->GetClassName() == className)
             {
             {
                 asIScriptObject* object = instance->GetScriptObject();
                 asIScriptObject* object = instance->GetScriptObject();

+ 3 - 3
Engine/Engine/UIAPI.cpp

@@ -81,7 +81,7 @@ static void RegisterUIElement(asIScriptEngine* engine)
     
     
     RegisterUIElement<UIElement>(engine, "UIElement");
     RegisterUIElement<UIElement>(engine, "UIElement");
     
     
-    // Register Variant GetPtr() for UIElement
+    // Register Variant Ptr() for UIElement
     engine->RegisterObjectMethod("Variant", "UIElement@+ GetUIElement() const", asFUNCTION(GetVariantPtr<UIElement>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Variant", "UIElement@+ GetUIElement() const", asFUNCTION(GetVariantPtr<UIElement>), asCALL_CDECL_OBJLAST);
 }
 }
 
 
@@ -418,7 +418,7 @@ static UIElement* UILoadLayout(XMLFile* file, UI* ptr)
     SharedPtr<UIElement> root = ptr->LoadLayout(file);
     SharedPtr<UIElement> root = ptr->LoadLayout(file);
     if (root)
     if (root)
         root->AddRef();
         root->AddRef();
-    return root.GetPtr();
+    return root.Ptr();
 }
 }
 
 
 static UIElement* UILoadLayoutWithStyle(XMLFile* file, XMLFile* styleFile, UI* ptr)
 static UIElement* UILoadLayoutWithStyle(XMLFile* file, XMLFile* styleFile, UI* ptr)
@@ -426,7 +426,7 @@ static UIElement* UILoadLayoutWithStyle(XMLFile* file, XMLFile* styleFile, UI* p
     SharedPtr<UIElement> root = ptr->LoadLayout(file, styleFile);
     SharedPtr<UIElement> root = ptr->LoadLayout(file, styleFile);
     if (root)
     if (root)
         root->AddRef();
         root->AddRef();
-    return root.GetPtr();
+    return root.Ptr();
 }
 }
 
 
 static void RegisterUI(asIScriptEngine* engine)
 static void RegisterUI(asIScriptEngine* engine)

+ 1 - 1
Engine/Graphics/AnimatedModel.cpp

@@ -629,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].Ptr() : 0;
 }
 }
 
 
 void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
 void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)

+ 1 - 1
Engine/Graphics/Direct3D9/D3D9IndexBuffer.cpp

@@ -162,7 +162,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
         }
         }
     }
     }
     else
     else
-        hwData = fallbackData_.GetPtr() + start * indexSize_;
+        hwData = fallbackData_.Ptr() + start * indexSize_;
     
     
     locked_ = true;
     locked_ = true;
     return hwData;
     return hwData;

+ 1 - 1
Engine/Graphics/Direct3D9/D3D9Shader.cpp

@@ -143,7 +143,7 @@ bool Shader::Load(Deserializer& source)
         if (dataSize)
         if (dataSize)
         {
         {
             SharedArrayPtr<unsigned char> byteCode(new unsigned char[dataSize]);
             SharedArrayPtr<unsigned char> byteCode(new unsigned char[dataSize]);
-            source.Read(byteCode.GetPtr(), dataSize);
+            source.Read(byteCode.Ptr(), dataSize);
             variation->SetByteCode(byteCode);
             variation->SetByteCode(byteCode);
         }
         }
         
         

+ 2 - 2
Engine/Graphics/Direct3D9/D3D9ShaderVariation.cpp

@@ -56,14 +56,14 @@ bool ShaderVariation::Create()
     if (shaderType_ == VS)
     if (shaderType_ == VS)
     {
     {
         if (!device || FAILED(device->CreateVertexShader(
         if (!device || FAILED(device->CreateVertexShader(
-            (const DWORD*)byteCode_.GetPtr(),
+            (const DWORD*)byteCode_.Ptr(),
             (IDirect3DVertexShader9**)&object_)))
             (IDirect3DVertexShader9**)&object_)))
             failed_ = true;
             failed_ = true;
     }
     }
     else
     else
     {
     {
         if (!device || FAILED(device->CreatePixelShader(
         if (!device || FAILED(device->CreatePixelShader(
-            (const DWORD*)byteCode_.GetPtr(),
+            (const DWORD*)byteCode_.Ptr(),
             (IDirect3DPixelShader9**)&object_)))
             (IDirect3DPixelShader9**)&object_)))
             failed_ = true;
             failed_ = true;
     }
     }

+ 2 - 2
Engine/Graphics/Direct3D9/D3D9VertexBuffer.cpp

@@ -226,7 +226,7 @@ void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
         }
         }
     }
     }
     else
     else
-        hwData = fallbackData_.GetPtr() + start * vertexSize_;
+        hwData = fallbackData_.Ptr() + start * vertexSize_;
     
     
     locked_ = true;
     locked_ = true;
     return hwData;
     return hwData;
@@ -258,7 +258,7 @@ void VertexBuffer::ResetMorphRange(void* lockedMorphRange)
     if (!lockedMorphRange || !morphRangeResetData_)
     if (!lockedMorphRange || !morphRangeResetData_)
         return;
         return;
     
     
-    memcpy(lockedMorphRange, morphRangeResetData_.GetPtr(), morphRangeCount_ * vertexSize_);
+    memcpy(lockedMorphRange, morphRangeResetData_.Ptr(), morphRangeCount_ * vertexSize_);
 }
 }
 
 
 void VertexBuffer::ClearDataLost()
 void VertexBuffer::ClearDataLost()

+ 3 - 3
Engine/Graphics/Geometry.cpp

@@ -198,7 +198,7 @@ void Geometry::GetRawData(const unsigned char*& vertexData, unsigned& vertexSize
 {
 {
     if (rawVertexData_)
     if (rawVertexData_)
     {
     {
-        vertexData = rawVertexData_.GetPtr();
+        vertexData = rawVertexData_.Ptr();
         vertexSize = 3 * sizeof(float);
         vertexSize = 3 * sizeof(float);
     }
     }
     else
     else
@@ -209,7 +209,7 @@ void Geometry::GetRawData(const unsigned char*& vertexData, unsigned& vertexSize
     
     
     if (rawIndexData_ && indexBuffer_)
     if (rawIndexData_ && indexBuffer_)
     {
     {
-        indexData = rawIndexData_.GetPtr();
+        indexData = rawIndexData_.Ptr();
         indexSize = indexBuffer_->GetIndexSize();
         indexSize = indexBuffer_->GetIndexSize();
     }
     }
     else
     else
@@ -224,7 +224,7 @@ float Geometry::GetDistance(const Ray& ray)
     if (!rawIndexData_ || !rawVertexData_ || !indexBuffer_)
     if (!rawIndexData_ || !rawVertexData_ || !indexBuffer_)
         return M_INFINITY;
         return M_INFINITY;
     
     
-    return ray.Distance(rawVertexData_.GetPtr(), 3 * sizeof(float), rawIndexData_.GetPtr(), indexBuffer_->GetIndexSize(), indexStart_, indexCount_);
+    return ray.Distance(rawVertexData_.Ptr(), 3 * sizeof(float), rawIndexData_.Ptr(), indexBuffer_->GetIndexSize(), indexStart_, indexCount_);
 }
 }
 
 
 void Geometry::GetPositionBufferIndex()
 void Geometry::GetPositionBufferIndex()

+ 4 - 4
Engine/Graphics/Model.cpp

@@ -119,13 +119,13 @@ bool Model::Load(Deserializer& source)
             if (morphCount)
             if (morphCount)
             {
             {
                 SharedArrayPtr<unsigned char> morphResetData(new unsigned char[morphCount * vertexSize]);
                 SharedArrayPtr<unsigned char> morphResetData(new unsigned char[morphCount * vertexSize]);
-                memcpy(morphResetData.GetPtr(), &data[morphStart * vertexSize], morphCount * vertexSize);
+                memcpy(morphResetData.Ptr(), &data[morphStart * vertexSize], morphCount * vertexSize);
                 buffer->SetMorphRangeResetData(morphResetData);
                 buffer->SetMorphRangeResetData(morphResetData);
             }
             }
 
 
             // Copy the raw position data for CPU-side operations
             // Copy the raw position data for CPU-side operations
             SharedArrayPtr<unsigned char> rawVertexData(new unsigned char[3 * sizeof(float) * vertexCount]);
             SharedArrayPtr<unsigned char> rawVertexData(new unsigned char[3 * sizeof(float) * vertexCount]);
-            float* rawDest = (float*)rawVertexData.GetPtr();
+            float* rawDest = (float*)rawVertexData.Ptr();
             for (unsigned i = 0; i < vertexCount; ++i)
             for (unsigned i = 0; i < vertexCount; ++i)
             {
             {
                 float* rawSrc = (float*)&data[i * vertexSize];
                 float* rawSrc = (float*)&data[i * vertexSize];
@@ -160,7 +160,7 @@ bool Model::Load(Deserializer& source)
 
 
             // Copy the raw index data for CPU-side operations
             // Copy the raw index data for CPU-side operations
             SharedArrayPtr<unsigned char> rawIndexData(new unsigned char[indexSize * indexCount]);
             SharedArrayPtr<unsigned char> rawIndexData(new unsigned char[indexSize * indexCount]);
-            memcpy(rawIndexData.GetPtr(), data, indexSize * indexCount);
+            memcpy(rawIndexData.Ptr(), data, indexSize * indexCount);
             rawIndexDatas.Push(rawIndexData);
             rawIndexDatas.Push(rawIndexData);
 
 
             buffer->Unlock();
             buffer->Unlock();
@@ -362,7 +362,7 @@ bool Model::Save(Serializer& dest)
             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_.Ptr(), vertexSize * j->second_.vertexCount_);
         }
         }
     }
     }
     
     

+ 5 - 5
Engine/Graphics/OcclusionBuffer.cpp

@@ -79,7 +79,7 @@ bool OcclusionBuffer::SetSize(int width, int height)
     height_ = height;
     height_ = 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_.Ptr() + 1 * width;
     mipBuffers_.Clear();
     mipBuffers_.Clear();
     
     
     // Build buffers for mip levels
     // Build buffers for mip levels
@@ -220,7 +220,7 @@ void OcclusionBuffer::BuildDepthHierarchy()
         for (int y = 0; y < height; ++y)
         for (int y = 0; y < height; ++y)
         {
         {
             int* src = buffer_ + (y * 2) * width_;
             int* src = buffer_ + (y * 2) * width_;
-            DepthValue* dest = mipBuffers_[0].GetPtr() + y * width;
+            DepthValue* dest = mipBuffers_[0].Ptr() + y * width;
             DepthValue* end = dest + width;
             DepthValue* end = dest + width;
             
             
             if (y * 2 + 1 < height_)
             if (y * 2 + 1 < height_)
@@ -264,8 +264,8 @@ void OcclusionBuffer::BuildDepthHierarchy()
         
         
         for (int y = 0; y < height; ++y)
         for (int y = 0; y < height; ++y)
         {
         {
-            DepthValue* src = mipBuffers_[i - 1].GetPtr() + (y * 2) * prevWidth;
-            DepthValue* dest = mipBuffers_[i].GetPtr() + y * width;
+            DepthValue* src = mipBuffers_[i - 1].Ptr() + (y * 2) * prevWidth;
+            DepthValue* dest = mipBuffers_[i].Ptr() + y * width;
             DepthValue* end = dest + width;
             DepthValue* end = dest + width;
             
             
             if (y * 2 + 1 < prevHeight)
             if (y * 2 + 1 < prevHeight)
@@ -388,7 +388,7 @@ bool OcclusionBuffer::IsVisible(const BoundingBox& worldSpaceBox) const
             int left = rect.left_ >> shift;
             int left = rect.left_ >> shift;
             int right = rect.right_ >> shift;
             int right = rect.right_ >> shift;
             
             
-            DepthValue* buffer = mipBuffers_[i].GetPtr();
+            DepthValue* buffer = mipBuffers_[i].Ptr();
             DepthValue* row = buffer + (rect.top_ >> shift) * width;
             DepthValue* row = buffer + (rect.top_ >> shift) * width;
             DepthValue* endRow = buffer + (rect.bottom_ >> shift) * width;
             DepthValue* endRow = buffer + (rect.bottom_ >> shift) * width;
             bool allOccluded = true;
             bool allOccluded = true;

+ 2 - 2
Engine/IO/FileSystem.cpp

@@ -222,8 +222,8 @@ bool FileSystem::Copy(const String& srcFileName, const String& destFileName)
     unsigned fileSize = srcFile->GetSize();
     unsigned fileSize = srcFile->GetSize();
     
     
     SharedArrayPtr<unsigned char> buffer(new unsigned char[fileSize]);
     SharedArrayPtr<unsigned char> buffer(new unsigned char[fileSize]);
-    unsigned bytesRead = srcFile->Read(buffer.GetPtr(), fileSize);
-    unsigned bytesWritten = destFile->Write(buffer.GetPtr(), fileSize);
+    unsigned bytesRead = srcFile->Read(buffer.Ptr(), fileSize);
+    unsigned bytesWritten = destFile->Write(buffer.Ptr(), fileSize);
     
     
     return bytesRead == fileSize && bytesWritten == fileSize;
     return bytesRead == fileSize && bytesWritten == fileSize;
 }
 }

+ 2 - 2
Engine/Network/Client.cpp

@@ -599,7 +599,7 @@ void Client::HandleServerUpdate(VectorBuffer& packet, bool initial)
     using namespace ServerUpdate;
     using namespace ServerUpdate;
     
     
     VariantMap eventData;
     VariantMap eventData;
-    eventData[P_SCENE] = (void*)scene_.GetPtr();
+    eventData[P_SCENE] = (void*)scene_.Ptr();
     SendEvent(E_SERVERUPDATE, eventData);
     SendEvent(E_SERVERUPDATE, eventData);
 }
 }
 
 
@@ -777,7 +777,7 @@ void Client::SendClientUpdate()
     using namespace ControlsUpdate;
     using namespace ControlsUpdate;
     
     
     VariantMap eventData;
     VariantMap eventData;
-    eventData[P_SCENE] = (void*)scene_.GetPtr();
+    eventData[P_SCENE] = (void*)scene_.Ptr();
     SendEvent(E_CONTROLSUPDATE, eventData);
     SendEvent(E_CONTROLSUPDATE, eventData);
     
     
     // Purge acked and expired remote events
     // Purge acked and expired remote events

+ 2 - 2
Engine/Network/Connection.cpp

@@ -117,7 +117,7 @@ void Connection::JoinedScene()
         
         
         VariantMap eventData;
         VariantMap eventData;
         eventData[P_CONNECTION] = (void*)this;
         eventData[P_CONNECTION] = (void*)this;
-        eventData[P_SCENE] = (void*)scene_.GetPtr();
+        eventData[P_SCENE] = (void*)scene_.Ptr();
         SendEvent(E_CLIENTJOINEDSCENE, eventData);
         SendEvent(E_CLIENTJOINEDSCENE, eventData);
         
         
         LOGINFO("Client " + GetIdentity() + " joined scene " + scene_->GetName());
         LOGINFO("Client " + GetIdentity() + " joined scene " + scene_->GetName());
@@ -139,7 +139,7 @@ void Connection::LeftScene()
             
             
             VariantMap eventData;
             VariantMap eventData;
             eventData[P_CONNECTION] = (void*)this;
             eventData[P_CONNECTION] = (void*)this;
-            eventData[P_SCENE] = (void*)scene_.GetPtr();
+            eventData[P_SCENE] = (void*)scene_.Ptr();
             SendEvent(E_CLIENTLEFTSCENE, eventData);
             SendEvent(E_CLIENTLEFTSCENE, eventData);
             
             
             LOGINFO("Client " + GetIdentity() + " left scene " + scene_->GetName());
             LOGINFO("Client " + GetIdentity() + " left scene " + scene_->GetName());

+ 2 - 2
Engine/Network/Network.cpp

@@ -190,7 +190,7 @@ Peer* Network::Connect(const String& address, unsigned short port)
     
     
     // Create a Peer instance for the server
     // Create a Peer instance for the server
     SharedPtr<Peer> newPeer(new Peer(context_, enetPeer, PEER_SERVER));
     SharedPtr<Peer> newPeer(new Peer(context_, enetPeer, PEER_SERVER));
-    enetPeer->data = newPeer.GetPtr();
+    enetPeer->data = newPeer.Ptr();
     peers_.Push(newPeer);
     peers_.Push(newPeer);
     
     
     LOGINFO("Connecting to " + address + ":" + String(port));
     LOGINFO("Connecting to " + address + ":" + String(port));
@@ -323,7 +323,7 @@ void Network::Update(ENetHost* enetHost)
             {
             {
                 // If no existing Peer instance (server operation), create one now
                 // If no existing Peer instance (server operation), create one now
                 SharedPtr<Peer> newPeer(new Peer(context_, enetPeer, PEER_CLIENT));
                 SharedPtr<Peer> newPeer(new Peer(context_, enetPeer, PEER_CLIENT));
-                enetPeer->data = newPeer.GetPtr();
+                enetPeer->data = newPeer.Ptr();
                 peers_.Push(newPeer);
                 peers_.Push(newPeer);
                 newPeer->OnConnect();
                 newPeer->OnConnect();
             }
             }

+ 7 - 7
Engine/Physics/CollisionShape.cpp

@@ -177,7 +177,7 @@ TriangleMeshData::TriangleMeshData(Model* model, bool makeConvexHull, float thic
         StanHull::HullDesc desc;
         StanHull::HullDesc desc;
         desc.SetHullFlag(StanHull::QF_TRIANGLES);
         desc.SetHullFlag(StanHull::QF_TRIANGLES);
         desc.mVcount = originalVertexCount;
         desc.mVcount = originalVertexCount;
-        desc.mVertices = (float*)originalVertices.GetPtr();
+        desc.mVertices = (float*)originalVertices.Ptr();
         desc.mVertexStride = 3 * sizeof(float);
         desc.mVertexStride = 3 * sizeof(float);
         desc.mSkinWidth = thickness;
         desc.mSkinWidth = thickness;
         
         
@@ -190,19 +190,19 @@ TriangleMeshData::TriangleMeshData(Model* model, bool makeConvexHull, float thic
         
         
         // Copy vertex data
         // Copy vertex data
         vertexData_ = new Vector3[vertexCount];
         vertexData_ = new Vector3[vertexCount];
-        memcpy(vertexData_.GetPtr(), result.mOutputVertices, vertexCount * sizeof(Vector3));
+        memcpy(vertexData_.Ptr(), result.mOutputVertices, vertexCount * sizeof(Vector3));
         
         
         // Copy index data
         // Copy index data
         indexData_ = new unsigned[indexCount];
         indexData_ = new unsigned[indexCount];
-        memcpy(indexData_.GetPtr(), result.mIndices, indexCount * sizeof(unsigned));
+        memcpy(indexData_.Ptr(), result.mIndices, indexCount * sizeof(unsigned));
         
         
         lib.ReleaseResult(result);
         lib.ReleaseResult(result);
     }
     }
     
     
     triMesh_ = dGeomTriMeshDataCreate();
     triMesh_ = dGeomTriMeshDataCreate();
     
     
-    dGeomTriMeshDataBuildSingle(triMesh_, vertexData_.GetPtr(), sizeof(Vector3), vertexCount,
-        indexData_.GetPtr(), indexCount, 3 * sizeof(unsigned));
+    dGeomTriMeshDataBuildSingle(triMesh_, vertexData_.Ptr(), sizeof(Vector3), vertexCount,
+        indexData_.Ptr(), indexCount, 3 * sizeof(unsigned));
     
     
     indexCount_ = indexCount;
     indexCount_ = indexCount;
 }
 }
@@ -281,7 +281,7 @@ HeightfieldData::HeightfieldData(Model* model, IntVector2 numPoints, float thick
     
     
     heightfield_ = dGeomHeightfieldDataCreate();
     heightfield_ = dGeomHeightfieldDataCreate();
     
     
-    dGeomHeightfieldDataBuildSingle(heightfield_, heightData_.GetPtr(), 0, (box.max_.x_ - box.min_.x_) * scale.x_,
+    dGeomHeightfieldDataBuildSingle(heightfield_, heightData_.Ptr(), 0, (box.max_.x_ - box.min_.x_) * scale.x_,
         (box.max_.z_ - box.min_.z_) * scale.z_, numPoints.x_, numPoints.y_, 1.0f, 0.0f, thickness, 0);
         (box.max_.z_ - box.min_.z_) * scale.z_, numPoints.x_, numPoints.y_, 1.0f, 0.0f, thickness, 0);
     dGeomHeightfieldDataSetBounds(heightfield_, box.min_.y_ * scale.y_, box.max_.y_ * scale.y_);
     dGeomHeightfieldDataSetBounds(heightfield_, box.min_.y_ * scale.y_, box.max_.y_ * scale.y_);
 }
 }
@@ -720,7 +720,7 @@ void CollisionShape::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
         
         
     case dTriMeshClass:
     case dTriMeshClass:
         {
         {
-            TriangleMeshData* data = static_cast<TriangleMeshData*>(geometryData_.GetPtr());
+            TriangleMeshData* data = static_cast<TriangleMeshData*>(geometryData_.Ptr());
             if (!data)
             if (!data)
                 return;
                 return;
             
             

+ 2 - 2
Engine/Physics/PhysicsWorld.cpp

@@ -463,7 +463,7 @@ void PhysicsWorld::CleanupGeometryCache()
         i != triangleMeshCache_.End();)
         i != triangleMeshCache_.End();)
     {
     {
         Map<String, SharedPtr<TriangleMeshData> >::Iterator current = i++;
         Map<String, SharedPtr<TriangleMeshData> >::Iterator current = i++;
-        if (current->second_.GetRefCount() == 1)
+        if (current->second_.Refs() == 1)
             triangleMeshCache_.Erase(current);
             triangleMeshCache_.Erase(current);
     }
     }
     
     
@@ -471,7 +471,7 @@ void PhysicsWorld::CleanupGeometryCache()
         i != heightfieldCache_.End();)
         i != heightfieldCache_.End();)
     {
     {
         Map<String, SharedPtr<HeightfieldData> >::Iterator current = i++;
         Map<String, SharedPtr<HeightfieldData> >::Iterator current = i++;
-        if (current->second_.GetRefCount() == 1)
+        if (current->second_.Refs() == 1)
             heightfieldCache_.Erase(current);
             heightfieldCache_.Erase(current);
     }
     }
 }
 }

+ 9 - 9
Engine/Resource/Image.cpp

@@ -235,7 +235,7 @@ bool Image::Load(Deserializer& source)
         if (!numCompressedLevels_)
         if (!numCompressedLevels_)
             numCompressedLevels_ = 1;
             numCompressedLevels_ = 1;
         SetMemoryUse(dataSize);
         SetMemoryUse(dataSize);
-        source.Read(data_.GetPtr(), dataSize);
+        source.Read(data_.Ptr(), dataSize);
     }
     }
     
     
     return true;
     return true;
@@ -261,7 +261,7 @@ void Image::SetSize(int width, int height, unsigned components)
 
 
 void Image::SetData(const unsigned char* pixelData)
 void Image::SetData(const unsigned char* pixelData)
 {
 {
-    memcpy(data_.GetPtr(), pixelData, width_ * height_ * components_);
+    memcpy(data_.Ptr(), pixelData, width_ * height_ * components_);
 }
 }
 
 
 bool Image::SaveBMP(const String& fileName)
 bool Image::SaveBMP(const String& fileName)
@@ -280,7 +280,7 @@ bool Image::SaveBMP(const String& fileName)
     }
     }
     
     
     if (data_)
     if (data_)
-        return stbi_write_bmp(fileName.CString(), width_, height_, components_, data_.GetPtr()) != 0;
+        return stbi_write_bmp(fileName.CString(), width_, height_, components_, data_.Ptr()) != 0;
     else
     else
         return false;
         return false;
 }
 }
@@ -301,7 +301,7 @@ bool Image::SaveTGA(const String& fileName)
     }
     }
     
     
     if (data_)
     if (data_)
-        return stbi_write_tga(fileName.CString(), width_, height_, components_, data_.GetPtr()) != 0;
+        return stbi_write_tga(fileName.CString(), width_, height_, components_, data_.Ptr()) != 0;
     else
     else
         return false;
         return false;
 }
 }
@@ -311,8 +311,8 @@ unsigned char* Image::GetImageData(Deserializer& source, int& width, int& height
     unsigned dataSize = source.GetSize();
     unsigned dataSize = source.GetSize();
     
     
     SharedArrayPtr<unsigned char> buffer(new unsigned char[dataSize]);
     SharedArrayPtr<unsigned char> buffer(new unsigned char[dataSize]);
-    source.Read(buffer.GetPtr(), dataSize);
-    return stbi_load_from_memory(buffer.GetPtr(), dataSize, &width, &height, (int *)&components, 0);
+    source.Read(buffer.Ptr(), dataSize);
+    return stbi_load_from_memory(buffer.Ptr(), dataSize, &width, &height, (int *)&components, 0);
 }
 }
 
 
 void Image::FreeImageData(unsigned char* pixelData)
 void Image::FreeImageData(unsigned char* pixelData)
@@ -347,8 +347,8 @@ SharedPtr<Image> Image::GetNextLevel() const
     SharedPtr<Image> mipImage(new Image(context_));
     SharedPtr<Image> mipImage(new Image(context_));
     mipImage->SetSize(widthOut, heightOut, components_);
     mipImage->SetSize(widthOut, heightOut, components_);
     
     
-    const unsigned char* pixelDataIn = data_.GetPtr();
-    unsigned char* pixelDataOut = mipImage->data_.GetPtr();
+    const unsigned char* pixelDataIn = data_.Ptr();
+    unsigned char* pixelDataOut = mipImage->data_.Ptr();
     
     
     // 1D case
     // 1D case
     if (height_ == 1 || width_ == 1)
     if (height_ == 1 || width_ == 1)
@@ -494,7 +494,7 @@ CompressedLevel Image::GetCompressedLevel(unsigned index) const
         
         
         level.rowSize_ = ((level.width_ + 3) / 4) * level.blockSize_;
         level.rowSize_ = ((level.width_ + 3) / 4) * level.blockSize_;
         level.rows_ = ((level.height_ + 3) / 4);
         level.rows_ = ((level.height_ + 3) / 4);
-        level.data_ = data_.GetPtr() + offset;
+        level.data_ = data_.Ptr() + offset;
         level.dataSize_ = level.rows_ * level.rowSize_;
         level.dataSize_ = level.rows_ * level.rowSize_;
         
         
         if (offset + level.dataSize_ > GetMemoryUse())
         if (offset + level.dataSize_ > GetMemoryUse())

+ 1 - 1
Engine/Resource/Resource.cpp

@@ -63,7 +63,7 @@ void Resource::ResetUseTimer()
 unsigned Resource::GetUseTimer()
 unsigned Resource::GetUseTimer()
 {
 {
     // If more references than the resource cache, return always 0 & reset the timer
     // If more references than the resource cache, return always 0 & reset the timer
-    if (GetRefCount() > 1)
+    if (Refs() > 1)
     {
     {
         useTimer_.Reset();
         useTimer_.Reset();
         return 0;
         return 0;

+ 1 - 1
Engine/Resource/Resource.h

@@ -94,7 +94,7 @@ template <class T> Vector<StringHash> GetResourceHashes(const Vector<SharedPtr<T
 {
 {
     Vector<StringHash> ret(resources.Size());
     Vector<StringHash> ret(resources.Size());
     for (unsigned i = 0; i < resources.Size(); ++i)
     for (unsigned i = 0; i < resources.Size(); ++i)
-        ret[i] = GetResourceHash(resources[i].GetPtr());
+        ret[i] = GetResourceHash(resources[i].Ptr());
     
     
     return ret;
     return ret;
 }
 }

+ 7 - 7
Engine/Resource/ResourceCache.cpp

@@ -188,7 +188,7 @@ void ResourceCache::ReleaseResource(ShortStringHash type, StringHash nameHash, b
         return;
         return;
     
     
     // If other references exist, do not release, unless forced
     // If other references exist, do not release, unless forced
-    if (existingRes.GetRefCount() == 1 || force)
+    if (existingRes.Refs() == 1 || force)
     {
     {
         resourceGroups_[type].resources_.Erase(nameHash);
         resourceGroups_[type].resources_.Erase(nameHash);
         UpdateResourceGroup(type);
         UpdateResourceGroup(type);
@@ -209,7 +209,7 @@ void ResourceCache::ReleaseResources(ShortStringHash type, bool force)
             {
             {
                 Map<StringHash, SharedPtr<Resource> >::Iterator current = j++;
                 Map<StringHash, SharedPtr<Resource> >::Iterator current = j++;
                 // If other references exist, do not release, unless forced
                 // If other references exist, do not release, unless forced
-                if (current->second_.GetRefCount() == 1 || force)
+                if (current->second_.Refs() == 1 || force)
                 {
                 {
                     i->second_.resources_.Erase(current);
                     i->second_.resources_.Erase(current);
                     released = true;
                     released = true;
@@ -239,7 +239,7 @@ void ResourceCache::ReleaseResources(ShortStringHash type, const String& partial
                 if (current->second_->GetName().Find(partialNameLower) != String::NPOS)
                 if (current->second_->GetName().Find(partialNameLower) != String::NPOS)
                 {
                 {
                     // If other references exist, do not release, unless forced
                     // If other references exist, do not release, unless forced
-                    if (current->second_.GetRefCount() == 1 || force)
+                    if (current->second_.Refs() == 1 || force)
                     {
                     {
                         i->second_.resources_.Erase(current);
                         i->second_.resources_.Erase(current);
                         released = true;
                         released = true;
@@ -265,7 +265,7 @@ void ResourceCache::ReleaseAllResources(bool force)
         {
         {
             Map<StringHash, SharedPtr<Resource> >::Iterator current = j++;
             Map<StringHash, SharedPtr<Resource> >::Iterator current = j++;
             // If other references exist, do not release, unless forced
             // If other references exist, do not release, unless forced
-            if (current->second_.GetRefCount() == 1 || force)
+            if (current->second_.Refs() == 1 || force)
             {
             {
                 i->second_.resources_.Erase(current);
                 i->second_.resources_.Erase(current);
                 released = true;
                 released = true;
@@ -286,7 +286,7 @@ bool ResourceCache::ReloadResource(Resource* resource)
     bool success = false;
     bool success = false;
     SharedPtr<File> file = GetFile(resource->GetName());
     SharedPtr<File> file = GetFile(resource->GetName());
     if (file)
     if (file)
-        success = resource->Load(*(file.GetPtr()));
+        success = resource->Load(*(file.Ptr()));
     
     
     if (success)
     if (success)
     {
     {
@@ -378,7 +378,7 @@ Resource* ResourceCache::GetResource(ShortStringHash type, StringHash nameHash)
     
     
     LOGDEBUG("Loading resource " + name);
     LOGDEBUG("Loading resource " + name);
     resource->SetName(file->GetName());
     resource->SetName(file->GetName());
-    if (!resource->Load(*(file.GetPtr())))
+    if (!resource->Load(*(file.Ptr())))
         return 0;
         return 0;
     
     
     // Store to cache
     // Store to cache
@@ -530,7 +530,7 @@ void ResourceCache::ReleasePackageResources(PackageFile* package, bool force)
             if (k != j->second_.resources_.End())
             if (k != j->second_.resources_.End())
             {
             {
                 // If other references exist, do not release, unless forced
                 // If other references exist, do not release, unless forced
-                if (k->second_.GetRefCount() == 1 || force)
+                if (k->second_.Refs() == 1 || force)
                 {
                 {
                     j->second_.resources_.Erase(k);
                     j->second_.resources_.Erase(k);
                     affectedGroups.Insert(j->first_);
                     affectedGroups.Insert(j->first_);

+ 2 - 2
Engine/Resource/XMLFile.cpp

@@ -58,13 +58,13 @@ bool XMLFile::Load(Deserializer& source)
         return false;
         return false;
     
     
     SharedArrayPtr<char> buffer(new char[dataSize + 1]);
     SharedArrayPtr<char> buffer(new char[dataSize + 1]);
-    if (source.Read(buffer.GetPtr(), dataSize) != dataSize)
+    if (source.Read(buffer.Ptr(), dataSize) != dataSize)
         return false;
         return false;
     
     
     buffer[dataSize] = 0;
     buffer[dataSize] = 0;
     
     
     document_->Clear();
     document_->Clear();
-    document_->Parse(buffer.GetPtr());
+    document_->Parse(buffer.Ptr());
     if (document_->Error())
     if (document_->Error())
     {
     {
         document_->ClearError();
         document_->ClearError();

+ 4 - 4
Engine/Scene/Node.cpp

@@ -83,7 +83,7 @@ void Node::OnEvent(Object* sender, bool broadcast, StringHash eventType, Variant
         for (unsigned i = components_.Size() - 1; i < components_.Size(); --i)
         for (unsigned i = components_.Size() - 1; i < components_.Size(); --i)
         {
         {
             components_[i]->OnEvent(sender, broadcast, eventType, eventData);
             components_[i]->OnEvent(sender, broadcast, eventType, eventData);
-            if (self.IsExpired())
+            if (self.Expired())
                 return;
                 return;
         }
         }
     }
     }
@@ -378,7 +378,7 @@ void Node::RemoveChild(Node* node)
     
     
     for (Vector<SharedPtr<Node> >::Iterator i = children_.Begin(); i != children_.End(); ++i)
     for (Vector<SharedPtr<Node> >::Iterator i = children_.Begin(); i != children_.End(); ++i)
     {
     {
-        if (i->GetPtr() == node)
+        if (i->Ptr() == node)
         {
         {
             RemoveChild(i);
             RemoveChild(i);
             return;
             return;
@@ -532,7 +532,7 @@ void Node::GetChildrenWithComponent(PODVector<Node*>& dest, ShortStringHash type
 
 
 Node* Node::GetChild(unsigned index) const
 Node* Node::GetChild(unsigned index) const
 {
 {
-    return index < children_.Size() ? children_[index].GetPtr() : 0;
+    return index < children_.Size() ? children_[index].Ptr() : 0;
 }
 }
 
 
 Node* Node::GetChild(const String& name, bool recursive) const
 Node* Node::GetChild(const String& name, bool recursive) const
@@ -580,7 +580,7 @@ bool Node::HasComponent(ShortStringHash type) const
 
 
 Component* Node::GetComponent(unsigned index) const
 Component* Node::GetComponent(unsigned index) const
 {
 {
-    return index < components_.Size() ? components_[index].GetPtr() : 0;
+    return index < components_.Size() ? components_[index].Ptr() : 0;
 }
 }
 
 
 Component* Node::GetComponent(ShortStringHash type, unsigned index) const
 Component* Node::GetComponent(ShortStringHash type, unsigned index) const

+ 8 - 8
Engine/Script/ScriptFile.cpp

@@ -328,7 +328,7 @@ bool ScriptFile::AddScriptSection(asIScriptEngine* engine, Deserializer& source)
     
     
     unsigned dataSize = source.GetSize();
     unsigned dataSize = source.GetSize();
     SharedArrayPtr<char> buffer(new char[dataSize]);
     SharedArrayPtr<char> buffer(new char[dataSize]);
-    source.Read((void*)buffer.GetPtr(), dataSize);
+    source.Read((void*)buffer.Ptr(), dataSize);
     
     
     // Pre-parse for includes
     // Pre-parse for includes
     // Adapted from Angelscript's scriptbuilder add-on
     // Adapted from Angelscript's scriptbuilder add-on
@@ -429,7 +429,7 @@ bool ScriptFile::AddScriptSection(asIScriptEngine* engine, Deserializer& source)
     }
     }
     
     
     // Then add this section
     // Then add this section
-    if (scriptModule_->AddScriptSection(source.GetName().CString(), (const char*)buffer.GetPtr(), dataSize) < 0)
+    if (scriptModule_->AddScriptSection(source.GetName().CString(), (const char*)buffer.Ptr(), dataSize) < 0)
     {
     {
         LOGERROR("Failed to add script section " + source.GetName());
         LOGERROR("Failed to add script section " + source.GetName());
         return false;
         return false;
@@ -479,27 +479,27 @@ void ScriptFile::SetParameters(asIScriptContext* context, asIScriptFunction* fun
                 case VAR_VECTOR2:
                 case VAR_VECTOR2:
                     context->SetArgObject(i, (void *)&parameters[i].GetVector2());
                     context->SetArgObject(i, (void *)&parameters[i].GetVector2());
                     break;
                     break;
-
+                    
                 case VAR_VECTOR3:
                 case VAR_VECTOR3:
                     context->SetArgObject(i, (void *)&parameters[i].GetVector3());
                     context->SetArgObject(i, (void *)&parameters[i].GetVector3());
                     break;
                     break;
-
+                    
                 case VAR_VECTOR4:
                 case VAR_VECTOR4:
                     context->SetArgObject(i, (void *)&parameters[i].GetVector4());
                     context->SetArgObject(i, (void *)&parameters[i].GetVector4());
                     break;
                     break;
-
+                    
                 case VAR_QUATERNION:
                 case VAR_QUATERNION:
                     context->SetArgObject(i, (void *)&parameters[i].GetQuaternion());
                     context->SetArgObject(i, (void *)&parameters[i].GetQuaternion());
                     break;
                     break;
-
+                    
                 case VAR_STRING:
                 case VAR_STRING:
                     context->SetArgObject(i, (void *)&parameters[i].GetString());
                     context->SetArgObject(i, (void *)&parameters[i].GetString());
                     break;
                     break;
-
+                    
                 case VAR_PTR:
                 case VAR_PTR:
                     context->SetArgObject(i, (void *)parameters[i].GetPtr());
                     context->SetArgObject(i, (void *)parameters[i].GetPtr());
                     break;
                     break;
-
+                    
                 default:
                 default:
                     break;
                     break;
                 }
                 }

+ 6 - 6
Engine/UI/UI.cpp

@@ -182,8 +182,8 @@ void UI::Update(float timeStep)
                 using namespace DragDropTest;
                 using namespace DragDropTest;
                 
                 
                 VariantMap eventData;
                 VariantMap eventData;
-                eventData[P_SOURCE] = (void*)dragElement_.GetPtr();
-                eventData[P_TARGET] = (void*)element.GetPtr();
+                eventData[P_SOURCE] = (void*)dragElement_.Ptr();
+                eventData[P_TARGET] = (void*)element.Ptr();
                 eventData[P_ACCEPT] = accept;
                 eventData[P_ACCEPT] = accept;
                 SendEvent(E_DRAGDROPTEST, eventData);
                 SendEvent(E_DRAGDROPTEST, eventData);
                 accept = eventData[P_ACCEPT].GetBool();
                 accept = eventData[P_ACCEPT].GetBool();
@@ -502,7 +502,7 @@ void UI::GetElementAt(UIElement*& result, UIElement* current, const IntVector2&
     for (PODVector<UIElement*>::ConstIterator i = children.Begin(); i != children.End(); ++i)
     for (PODVector<UIElement*>::ConstIterator i = children.Begin(); i != children.End(); ++i)
     {
     {
         UIElement* element = *i;
         UIElement* element = *i;
-        if (element != cursor_.GetPtr() && element->IsVisible())
+        if (element != cursor_.Ptr() && element->IsVisible())
         {
         {
             if (element->IsInside(position, true))
             if (element->IsInside(position, true))
             {
             {
@@ -635,7 +635,7 @@ void UI::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
         using namespace UIMouseClick;
         using namespace UIMouseClick;
         
         
         VariantMap eventData;
         VariantMap eventData;
-        eventData[UIMouseClick::P_ELEMENT] = (void*)element.GetPtr();
+        eventData[UIMouseClick::P_ELEMENT] = (void*)element.Ptr();
         eventData[UIMouseClick::P_X] = pos.x_;
         eventData[UIMouseClick::P_X] = pos.x_;
         eventData[UIMouseClick::P_Y] = pos.y_;
         eventData[UIMouseClick::P_Y] = pos.y_;
         eventData[UIMouseClick::P_BUTTON] = button;
         eventData[UIMouseClick::P_BUTTON] = button;
@@ -680,8 +680,8 @@ void UI::HandleMouseButtonUp(StringHash eventType, VariantMap& eventData)
                             using namespace DragDropFinish;
                             using namespace DragDropFinish;
                             
                             
                             VariantMap eventData;
                             VariantMap eventData;
-                            eventData[P_SOURCE] = (void*)dragElement_.GetPtr();
-                            eventData[P_TARGET] = (void*)target.GetPtr();
+                            eventData[P_SOURCE] = (void*)dragElement_.Ptr();
+                            eventData[P_TARGET] = (void*)target.Ptr();
                             eventData[P_ACCEPT] = accept;
                             eventData[P_ACCEPT] = accept;
                             SendEvent(E_DRAGDROPFINISH, eventData);
                             SendEvent(E_DRAGDROPFINISH, eventData);
                         }
                         }

+ 1 - 1
Engine/UI/UIElement.cpp

@@ -107,7 +107,7 @@ UIElement::~UIElement()
     while (children_.Size())
     while (children_.Size())
     {
     {
         const SharedPtr<UIElement>& element = children_.Back();
         const SharedPtr<UIElement>& element = children_.Back();
-        if (element.GetRefCount() > 1)
+        if (element.Refs() > 1)
         {
         {
             element->parent_ = 0;
             element->parent_ = 0;
             element->MarkDirty();
             element->MarkDirty();

+ 2 - 2
Tools/NormalMapTool/NormalMapTool.cpp

@@ -70,7 +70,7 @@ void Run(const Vector<String>& arguments)
     
     
     SharedArrayPtr<unsigned char> buffer(new unsigned char[image.GetWidth() * image.GetHeight() * 4]);
     SharedArrayPtr<unsigned char> buffer(new unsigned char[image.GetWidth() * image.GetHeight() * 4]);
     unsigned char* srcData = image.GetData();
     unsigned char* srcData = image.GetData();
-    unsigned char* destData = buffer.GetPtr();
+    unsigned char* destData = buffer.Ptr();
     
     
     for (int y = 0; y < image.GetHeight(); ++y)
     for (int y = 0; y < image.GetHeight(); ++y)
     {
     {
@@ -91,7 +91,7 @@ void Run(const Vector<String>& arguments)
     }
     }
     
     
     String tempDestName = arguments[0].Split('.')[0] + ".tga";
     String tempDestName = arguments[0].Split('.')[0] + ".tga";
-    stbi_write_tga(tempDestName.CString(), image.GetWidth(), image.GetHeight(), 4, buffer.GetPtr());
+    stbi_write_tga(tempDestName.CString(), image.GetWidth(), image.GetHeight(), 4, buffer.Ptr());
     
     
     String command = "texconv -f DXT5 -ft DDS -if NONE " + tempDestName;
     String command = "texconv -f DXT5 -ft DDS -if NONE " + tempDestName;
     int ret = system(command.CString());
     int ret = system(command.CString());

+ 2 - 2
Tools/RampGenerator/RampGenerator.cpp

@@ -80,7 +80,7 @@ void Run(const Vector<String>& arguments)
         data[0] = 255;
         data[0] = 255;
         data[width - 1] = 0;
         data[width - 1] = 0;
         
         
-        stbi_write_tga(tempDestName.CString(), width, 1, 1, data.GetPtr());
+        stbi_write_tga(tempDestName.CString(), width, 1, 1, data.Ptr());
     }
     }
     
     
     if (dimensions == 2)
     if (dimensions == 2)
@@ -113,7 +113,7 @@ void Run(const Vector<String>& arguments)
             data[x * width + (width - 1)] = 0;
             data[x * width + (width - 1)] = 0;
         }
         }
         
         
-        stbi_write_tga(tempDestName.CString(), width, width, 1, data.GetPtr());
+        stbi_write_tga(tempDestName.CString(), width, width, 1, data.Ptr());
     }
     }
     
     
     String command = "texconv -f R8G8B8 -ft PNG -if NONE " + tempDestName;
     String command = "texconv -f R8G8B8 -ft PNG -if NONE " + tempDestName;