コード例 #1
0
ファイル: Mesh.cs プロジェクト: TeoTwawki/ffxivmodelviewer
        protected override void Dispose(bool disposeManaged)
        {
            if (disposeManaged)
            {
                if (indexBuffer != null)
                {
                    indexBuffer.Dispose();
                    indexBuffer = null;
                }

                if (vertexBuffer != null)
                {
                    vertexBuffer.Dispose();
                    vertexBuffer = null;
                }

                if (vertexDecl != null)
                {
                    vertexDecl.Dispose();
                    vertexDecl = null;
                }

                if (pgrps != null)
                {
                    pgrps.ForEach(x => x.Dispose());
                    pgrps = null;
                }
            }
        }
コード例 #2
0
 public void Dispose()
 {
     vbuffer.Dispose();
     ibuffer.Dispose();
     declaration.Dispose();
     effect.Dispose();
 }
コード例 #3
0
        /// <summary>
        /// Frees resources used by this object.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (vertexDeclaration != null)
                {
                    vertexDeclaration.Dispose();
                }

                if (vertexBuffer != null)
                {
                    vertexBuffer.Dispose();
                }

                if (indexBuffer != null)
                {
                    indexBuffer.Dispose();
                }

                if (basicEffect != null)
                {
                    basicEffect.Dispose();
                }

                if (basicEffectShadow != null)
                {
                    basicEffectShadow.Dispose();
                }
            }
        }
コード例 #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing == true && isDisposed == false)
            {
                if (Disposing != null)
                {
                    Disposing(this, EventArgs.Empty);
                }

                if (vertexDeclaration != null)
                {
                    vertexDeclaration.Dispose();
                }
                if (vertexShader != null)
                {
                    vertexShader.Dispose();
                }
                if (pixelShader != null)
                {
                    pixelShader.Dispose();
                }
                if (vertexBuffer != null)
                {
                    vertexBuffer.Dispose();
                }
                if (indexBuffer != null)
                {
                    indexBuffer.Dispose();
                }

                isDisposed = true;
            }
        }
コード例 #5
0
        /// <summary>
        /// Frees resources used by this object.
        /// </summary>
        public void Dispose()
        {
            if (vertexDeclaration != null)
            {
                vertexDeclaration.Dispose();
            }

            if (vertexBuffer != null)
            {
                vertexBuffer.Dispose();
            }

            if (indexBuffer != null)
            {
                indexBuffer.Dispose();
            }

            if (basicEffect != null)
            {
                basicEffect.Dispose();
            }

            if (basicEffectShadow != null)
            {
                basicEffectShadow.Dispose();
            }
        }
コード例 #6
0
ファイル: Circle.cs プロジェクト: Wiciaki/SparkTech
        static Circle()
        {
            VertexBuffer = new VertexBuffer(Render.Device, Utilities.SizeOf <Vector4>() * 3, Usage.WriteOnly, VertexFormat.None, Pool.Managed);

            using (var ds = VertexBuffer.Lock(0, 0, LockFlags.None))
            {
                ds.WriteRange(new[] { new Vector4(-Radius, 0f, -Radius, 1.0f), new Vector4(0f, 0f, Radius, 1.0f), new Vector4(Radius, 0f, -Radius, 1.0f) });
            }

            VertexBuffer.Unlock();

            var vertexElements = new[] { new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), VertexElement.VertexDeclarationEnd };

            VertexDeclaration = new VertexDeclaration(Render.Device, vertexElements);

            Effect       = Effect.FromMemory(Render.Device, Resources.RenderEffectCompiled, ShaderFlags.None);
            EffectHandle = Effect.GetTechnique(0);

            Render.OnLostDevice  += Effect.OnLostDevice;
            Render.OnResetDevice += Effect.OnResetDevice;

            Render.OnDispose += () =>
            {
                Effect.Dispose();
                EffectHandle.Dispose();
                VertexBuffer.Dispose();
                VertexDeclaration.Dispose();
            };
        }
コード例 #7
0
        protected override void Dispose(bool disposing)
        {
            if (this.vertexBuffer != null)
            {
                this.vertexBuffer.Dispose();
                this.vertexBuffer = null;
            }

            if (this.indexBuffer != null)
            {
                this.indexBuffer.Dispose();
                this.indexBuffer = null;
            }

            if (vertexDeclaration != null)
            {
                vertexDeclaration.Dispose();
                vertexDeclaration = null;
            }

            if (basicEffect != null)
            {
                basicEffect.Dispose();
                basicEffect = null;
            }

            base.Dispose(disposing);
        }
コード例 #8
0
 void DisposeReferences()
 {
     if (Device != null)
     {
         if (state_old != null)
         {
             state_old.Dispose();
         }
         if (vb_cube != null)
         {
             vb_cube.Dispose();
         }
         if (vert_decl_nocolor != null)
         {
             vert_decl_nocolor.Dispose();
         }
         foreach (var font in fontCache)
         {
             font.Value.Dispose();
         }
         Device.Dispose();
         Device            = null;
         vert_decl_nocolor = null;
         vb_cube           = null;
         state_old         = null;
         fontCache.Clear();
     }
 }
コード例 #9
0
        /// <summary>
        /// Frees resources used by this object.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (vertexDeclaration != null)
                {
                    vertexDeclaration.Dispose();
                }

                if (vertexBuffer != null)
                {
                    vertexBuffer.Dispose();
                }

                if (indexBuffer != null)
                {
                    indexBuffer.Dispose();
                }

                if (shader != null)
                {
                    shader.Dispose();
                }
            }
        }
コード例 #10
0
 /// <summary>
 /// Unload content
 /// </summary>
 public void UnloadContent()
 {
     // unload effect and parameters
     effectTexture        = null;
     effectFrameOffset    = null;
     effectFrameSize      = null;
     effectFrameBlend     = null;
     effectViewProjection = null;
     effectTechnique      = null;
     effect = null;
     // unload vertex buffer and declaration
     if (vertexBuffer[0] != null)
     {
         vertexBuffer[0].Dispose();
         vertexBuffer[0] = null;
     }
     if (vertexBuffer[1] != null)
     {
         vertexBuffer[1].Dispose();
         vertexBuffer[1] = null;
     }
     if (vertexDeclaration != null)
     {
         vertexDeclaration.Dispose();
         vertexDeclaration = null;
     }
 }
コード例 #11
0
ファイル: TreeBatchModel.cs プロジェクト: yuri410/lrvbsvnicg
        protected override void unload()
        {
            if (vtxBuffer != null)
            {
                vtxBuffer.Dispose();

                vtxBuffer = null;
            }
            if (idxBuffer != null)
            {
                for (int i = 0; i < idxBuffer.Length; i++)
                {
                    if (idxBuffer[i] != null && !idxBuffer[i].Disposed)
                    {
                        idxBuffer[i].Dispose();
                    }
                }
                idxBuffer = null;
            }
            if (vtxDecl != null)
            {
                vtxDecl.Dispose();
                vtxDecl = null;
            }
        }
コード例 #12
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }

            _isDisposed = true;

            if (_effect != null)
            {
                _effect.Dispose();
                _effect = null;
            }

            if (_buffer != null)
            {
                _buffer.Dispose();
                _buffer = null;
            }

            if (_vertexDecl != null)
            {
                _vertexDecl.Dispose();
                _vertexDecl = null;
            }

            ClearStarMaps();
        }
コード例 #13
0
 /// <summary>
 /// Dispose
 /// </summary>
 /// <param name="disposing">Disposing</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         decl.Dispose();
     }
 }
コード例 #14
0
 public static void DisposeDeclaration()
 {
     if (_Declaration != null && !_Declaration.Disposed)
     {
         _Declaration.Dispose();
         _Declaration = null;
     }
 }
コード例 #15
0
 /// <summary>
 /// Liberar recursos
 /// </summary>
 public void dispose()
 {
     texture.dispose();
     particlesAlive = null;
     particlesDead  = null;
     particles      = null;
     vertexDeclaration.Dispose();
 }
コード例 #16
0
        }         // Load()

        #endregion

        #region Dispose
        /// <summary>
        /// Dispose
        /// </summary>
        public void Dispose()
        {
            if (decl != null)
            {
                decl.Dispose();
            }
            decl = null;
        }         // Dispose()
コード例 #17
0
ファイル: Mesh.cs プロジェクト: bondjames12/spheregame
 public void Dispose()
 {
     if (initialized)
     {
         vertexBuffer.Dispose();
         indexBuffer.Dispose();
         vertexDeclaration.Dispose();
     }
 }
コード例 #18
0
 public virtual void Dispose()
 {
     if (vertexBuffer == null)
     {
         return;
     }
     vertexBuffer.Dispose();
     vertexDecl.Dispose();
 }
コード例 #19
0
 public override void Dispose()
 {
     disposeChilderen();
     if (layout != null)
     {
         layout.Dispose();
         layout = null;
     }
     base.Dispose();
 }
コード例 #20
0
 public override void close()
 {
     vertexBuffer.Dispose();
     indexBuffer.Dispose();
     effect.Dispose();
     vertexDeclaration.Dispose();
     texture0.Dispose();
     texture1.Dispose();
     texture2.Dispose();
 }
コード例 #21
0
        protected override void UnloadGraphicsContent(bool unloadAllContent)
        {
            base.UnloadGraphicsContent(unloadAllContent);

            if (unloadAllContent)
            {
                vertexDecl.Dispose();
                vertexDecl = null;
            }
        }
コード例 #22
0
        private void ExtendVertexDeclaration(VertexElement[] extraElements)
        {
            _vertexDeclaration.Dispose();
            int length = originalVertexDeclaration.Length + extraElements.Length;

            VertexElement[] elements = new VertexElement[length];

            originalVertexDeclaration.CopyTo(elements, 0);
            extraElements.CopyTo(elements, originalVertexDeclaration.Length);
            _vertexDeclaration = new VertexDeclaration(game.GraphicsDevice, elements);
        }
コード例 #23
0
ファイル: D3D11Host.cs プロジェクト: swimming92404/ModelMod
        public virtual void Uninitialize()
        {
            _vertexBuffer.Dispose();
            _vertexBuffer = null;

            vertexDeclaration.Dispose();
            vertexDeclaration = null;

            _basicEffect.Dispose();
            _basicEffect = null;
        }
コード例 #24
0
        private void Unitialize()
        {
            _vertexBuffer.Dispose();
            _vertexBuffer = null;

            vertexDeclaration.Dispose();
            vertexDeclaration = null;

            _basicEffect.Dispose();
            _basicEffect = null;
        }
コード例 #25
0
        /// <summary>
        /// Clear all stored data for this drawTerrain, getting rid of all textures and other loaded things.
        /// </summary>
        public void Clear()
        {
            vertexDeclaration?.Dispose();
            textureManager?.Dispose();
            loadedTerrainTiles.Clear();
            terrainTiles.Clear();

            vertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);
            textureManager    = new TerrainTextureManager(terrtexPath, device, messageDelegate);
            SetTerrainReduction();
            DiscardVertexBuffers();
        }
コード例 #26
0
ファイル: RenderObjectXX.cs プロジェクト: ymilv/SB3Utility
        public void Dispose()
        {
            for (int i = 0; i < meshFrames.Count; i++)
            {
                MeshContainer mesh = meshFrames[i].MeshContainer;
                while (mesh != null)
                {
                    if ((mesh.MeshData != null) && (mesh.MeshData.Mesh != null))
                    {
                        mesh.MeshData.Mesh.Dispose();
                    }
                    if (mesh is MorphMeshContainer)
                    {
                        MorphMeshContainer morphMesh = (MorphMeshContainer)mesh;
                        if (morphMesh.StartBuffer != morphMesh.EndBuffer)
                        {
                            morphMesh.StartBuffer.Dispose();
                        }
                        if (morphMesh.EndBuffer != null)
                        {
                            morphMesh.EndBuffer.Dispose();
                        }
                        if (morphMesh.CommonBuffer != null)
                        {
                            morphMesh.CommonBuffer.Dispose();
                        }
                        if (morphMesh.IndexBuffer != null)
                        {
                            morphMesh.IndexBuffer.Dispose();
                        }
                    }

                    for (int j = 0; j < Textures.Length; j++)
                    {
                        Texture tex = Textures[j];
                        if ((tex != null) && !tex.Disposed)
                        {
                            tex.Dispose();
                        }
                    }

                    mesh = mesh.NextMeshContainer;
                }
            }

            rootFrame.Dispose();
            AnimationController.Dispose();

            tweeningVertDec.Dispose();

            IsDisposed = true;
        }
コード例 #27
0
ファイル: TgcMesh.cs プロジェクト: cata1322/YouAreAPirate
        /// <summary>
        /// Libera los recursos de la malla.
        /// Si la malla es una instancia se deshabilita pero no se liberan recursos.
        /// Si la malla es el original y tiene varias instancias adjuntadas, se hace dispose() también de las instancias.
        /// </summary>
        public void dispose()
        {
            this.enabled = false;
            if (boundingBox != null)
            {
                boundingBox.dispose();
            }

            //Si es una instancia no liberar nada, lo hace el original.
            if (parentInstance != null)
            {
                parentInstance = null;
                return;
            }

            //hacer dispose de instancias
            if (meshInstances != null)
            {
                foreach (TgcMesh meshInstance in meshInstances)
                {
                    meshInstance.dispose();
                }
                meshInstances = null;
            }


            //Dispose de mesh
            this.d3dMesh.Dispose();
            this.d3dMesh = null;

            //Dispose de texturas
            if (diffuseMaps != null)
            {
                for (int i = 0; i < diffuseMaps.Length; i++)
                {
                    if (diffuseMaps[i] != null)
                    {
                        diffuseMaps[i].dispose();
                    }
                }
                diffuseMaps = null;
            }
            if (lightMap != null)
            {
                lightMap.dispose();
                lightMap = null;
            }

            //VertexDeclaration
            vertexDeclaration.Dispose();
            vertexDeclaration = null;
        }
コード例 #28
0
 /// <summary>
 /// Disposes of the object, cleanly releasing graphics resources.
 /// </summary>
 public void Dispose()
 {
     if (effect != null)
     {
         effect.Dispose();
         effect = null;
     }
     if (vertexDeclaration != null)
     {
         vertexDeclaration.Dispose();
         vertexDeclaration = null;
     }
 }
コード例 #29
0
 public void Dispose()
 {
     if (_Buffer != null)
     {
         _Buffer.Dispose();
         _Buffer = null;
     }
     if (_Decl != null)
     {
         _Decl.Dispose();
         _Decl = null;
     }
 }
コード例 #30
0
    protected virtual void Dispose(bool all)
    {
        if (vDecl != null)
        {
            vDecl.Dispose();
            vDecl = null;
        }

        if (vBuffer != null)
        {
            vBuffer.Dispose();
            vBuffer = null;
        }
    }