/// <summary> /// Get a managed SharedPtr for the given ogre object. /// </summary> /// <param name="nativeObject">The native object to get the pointer for.</param> /// <returns>A new SharedPtr for the object.</returns> public SharedPtr <T> getObject(IntPtr nativeObject) { SharedPtrEntry <T> entry; if (nativeObject != IntPtr.Zero && ptrDictionary.TryGetValue(nativeObject, out entry)) { SharedPtr <T> sp = new SharedPtr <T>(entry.ManagedWrapper, nativeObject, entry.HeapSharedPtr, this); entry.addPointer(sp); if (OgreInterface.TrackMemoryLeaks) { allocationStackTraces.Add(sp, new StackTrace(true)); } return(sp); } return(null); }
/// <summary> /// Return a pointer to this collection. This is done in the SharedPtr /// dispose method. If all the references are returned the entry will be /// disposed and the heap allocated shared pointer will be released. /// </summary> /// <param name="sharedPtr"></param> public void returnPtr(SharedPtr <T> sharedPtr) { IntPtr key = sharedPtr.NativeObject; SharedPtrEntry <T> entry = ptrDictionary[key]; entry.removePointer(sharedPtr); if (OgreInterface.TrackMemoryLeaks) { allocationStackTraces.Remove(sharedPtr); } if (!entry.HasReferences) { ptrDictionary.Remove(key); deleteHeapSharedPtr(entry.HeapSharedPtr); entry.Dispose(); } }
internal MaterialPtr(SharedPtr <Material> sharedPtr) { this.sharedPtr = sharedPtr; }
internal TexturePtr(SharedPtr <Texture> sharedPtr) { this.sharedPtr = sharedPtr; }
internal HardwareVertexBufferSharedPtr(SharedPtr <HardwareVertexBuffer> sharedPtr) { this.sharedPtr = sharedPtr; }
internal HighLevelGpuProgramSharedPtr(SharedPtr <HighLevelGpuProgram> sharedPtr) { this.sharedPtr = sharedPtr; }
internal GpuSharedParametersPtr(SharedPtr <GpuSharedParameters> sharedPtr) { this.sharedPtr = sharedPtr; }
public void addPointer(SharedPtr <T> ptr) { ptrList.AddLast(ptr); }
public void removePointer(SharedPtr <T> ptr) { ptrList.Remove(ptr); }
internal MeshPtr(SharedPtr <Mesh> sharedPtr) { this.sharedPtr = sharedPtr; }
internal SkeletonPtr(SharedPtr <Skeleton> sharedPtr) { this.sharedPtr = sharedPtr; }
internal GpuProgramParametersSharedPtr(SharedPtr <GpuProgramParameters> sharedPtr) { this.sharedPtr = sharedPtr; }
internal OgreDataStreamPtr(SharedPtr <OgreDataStream> sharedPtr) { this.sharedPtr = sharedPtr; }
internal HardwarePixelBufferSharedPtr(SharedPtr <HardwarePixelBuffer> sharedPtr) { this.sharedPtr = sharedPtr; }