GCHandle handle; //This class keeps itself alive with a gchandle, so we put both of them in the CallbackHandler. This is needed for the class to not get collected.

            public IntPtr create(OgreManagedStream obj, String name, IntPtr size, AccessMode accessMode)
            {
                handle = GCHandle.Alloc(obj, GCHandleType.Normal);
                return(OgreManagedStream_Create(name, size, accessMode, readCallback, writeCallback, skipCallback, seekCallback, tellCallback, eofCallback, closeCallback, deletedCallback, GCHandle.ToIntPtr(handle)));
            }
示例#2
0
        /// <summary>
        /// Load an image from a stream. The stream will be controlled by ogre which will close it when
        /// it is done, however, you should still be able to follow normal using patterns on the stream
        /// you pass in.
        /// </summary>
        public void load(Stream stream, String type)
        {
            OgreManagedStream managedStream = new OgreManagedStream("Image", stream);

            Image_load(ptr, managedStream.NativeStream, type);
        }
        /// <summary>
        /// Load the microcode cache from the given stream. The stream will be controlled
        /// by ogre which will close it when it is done, however, you should still be able
        /// to follow normal using patterns on the stream you pass in.
        /// </summary>
        /// <param name="stream">The stream to load from, must be readable.</param>
        public void loadMicrocodeCache(Stream stream)
        {
            OgreManagedStream managedStream = new OgreManagedStream("MicrocodeLoadStream", stream);

            GpuProgramManager_loadMicrocodeCache(managedStream.NativeStream);
        }
 IntPtr open(String filename, bool readOnly)
 {
     OgreManagedStream managedStream = new OgreManagedStream(filename, doOpen(filename));
     return managedStream.NativeStream;
 }
        /// <summary>
        /// Save the microcode cache to the given stream. The stream will be controlled
        /// by ogre which will close it when it is done, however, you should still be able
        /// to follow normal using patterns on the stream you pass in.
        /// </summary>
        /// <param name="stream">The stream to save to, must be writable.</param>
        public void saveMicrocodeCache(Stream stream)
        {
            OgreManagedStream managedStream = new OgreManagedStream("MicrocodeSaveStream", stream);

            GpuProgramManager_saveMicrocodeCache(managedStream.NativeStream);
        }