Exemple #1
0
        /// <summary>
        /// Metodo que se invoca una sola vez al finalizar el ejemplo.
        /// Se debe liberar la memoria de todos los recursos utilizados.
        /// </summary>
        public override void Dispose()
        {
            //Liberar memoria de las cajas 3D.
            //Por mas que estamos en C# con Garbage Collector igual hay que liberar la memoria de los recursos gráficos.
            //Porque están utilizando memoria de la placa de video (y ahí no hay Garbage Collector).
            dynamicsWorld.Dispose();
            dispatcher.Dispose();
            collisionConfiguration.Dispose();
            constraintSolver.Dispose();
            overlappingPairCache.Dispose();
            foreach (RigidBody boxBody in boxBodys)
            {
                boxBody.Dispose();
            }
            foreach (RigidBody ballBody in ballBodys)
            {
                ballBody.Dispose();
            }
            floorBody.Dispose();

            boxMesh1.Dispose();
            boxMesh2.Dispose();
            boxMesh3.Dispose();
            boxMesh4.Dispose();
            sphereMesh.Dispose();
            floorMesh.Dispose();
        }
Exemple #2
0
        public void Dispose()
        {
            sphereMesh.Dispose();

            //Se hace dispose del modelo fisico.
            dynamicsWorld.Dispose();
            dispatcher.Dispose();
            collisionConfiguration.Dispose();
            constraintSolver.Dispose();
            overlappingPairCache.Dispose();
        }
        public void Dispose()
        {
            foreach (TGCBox stair in stairsMesh)
            {
                stair.Dispose();
            }

            sphereMesh.Dispose();
            dynamicsWorld.Dispose();
            dispatcher.Dispose();
            collisionConfiguration.Dispose();
            constraintSolver.Dispose();
            overlappingPairCache.Dispose();
        }
Exemple #4
0
        public void Dispose()
        {
            dynamicsWorld.Dispose();
            dispatcher.Dispose();
            collisionConfiguration.Dispose();
            constraintSolver.Dispose();
            overlappingPairCache.Dispose();
            boxBody.Dispose();
            ballBody.Dispose();
            floorBody.Dispose();

            boxMesh.Dispose();
            sphereMesh.Dispose();

            floorMesh.Dispose();
        }
Exemple #5
0
        public void Dispose()
        {
            //Dispose de los meshes.
            sphereMesh.Dispose();
            personaje.Dispose();
            boxMesh.Dispose();
            boxMeshB.Dispose();
            plataforma.Dispose();
            foreach (RigidBody peldanio in escalonesRigidBodies)
            {
                escalon.Dispose();
            }

            //Se hace dispose del modelo fisico.
            dynamicsWorld.Dispose();
            dispatcher.Dispose();
            collisionConfiguration.Dispose();
            constraintSolver.Dispose();
            overlappingPairCache.Dispose();
        }
Exemple #6
0
        private void InitializeSphere()
        {
            // Got to set a texture, else the translation to mesh does not map UV
            var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Texturas\\white.bmp");

            var sphere = new TGCSphere();

            sphere.Radius        = 40.0f;
            sphere.LevelOfDetail = 3;
            sphere.setTexture(texture);
            sphere.updateValues();

            sphereMesh             = sphere.toMesh("sphere");
            sphereMesh.Transform   = TGCMatrix.Scaling(TGCVector3.One * 30f);
            sphereMesh.Effect      = effect;
            sphereMesh.Technique   = "PBR";
            sphereMesh.DiffuseMaps = new TgcTexture[0];
            sphereMesh.RenderType  = TgcMesh.MeshRenderType.VERTEX_COLOR;
            sphere.Dispose();
        }
Exemple #7
0
        private void InitializePBRMesh()
        {
            // Got to set a texture, else the translation to mesh does not map UV
            var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Texturas\\white.bmp");

            var sphere = new TGCSphere();

            sphere.Radius        = 40.0f;
            sphere.LevelOfDetail = 3;
            sphere.setTexture(texture);
            sphere.updateValues();

            pbrMesh             = sphere.toMesh("sphere");
            pbrMesh.Effect      = effect;
            pbrMesh.Technique   = "PBRIBL";
            pbrMesh.DiffuseMaps = new TgcTexture[0];
            pbrMesh.RenderType  = TgcMesh.MeshRenderType.VERTEX_COLOR;
            sphere.Dispose();

            var texturePath = MediaDir + "Texturas\\";

            var scaling = TGCMatrix.Scaling(TGCVector3.One * 25f);
            var harsh   = new PBRTexturedMesh("Harsh-Metal", texturePath, scaling * TGCMatrix.Translation(0f, 100f, 100f), pbrMesh);
            var gold    = new PBRTexturedMesh("Gold", texturePath, scaling * TGCMatrix.Translation(0f, 100f, 0f), pbrMesh);
            var marble  = new PBRTexturedMesh("Marble", texturePath, scaling * TGCMatrix.Translation(0f, 100f, -100f), pbrMesh);
            var ground  = new PBRTexturedMesh("Ground", texturePath, scaling * TGCMatrix.Translation(0f, 100f, -200f), pbrMesh);
            var metal   = new PBRTexturedMesh("Metal", texturePath, scaling * TGCMatrix.Translation(0f, 100f, 200f), pbrMesh);

            pbrTexturedMeshes.AddRange(new List <PBRTexturedMesh> {
                harsh, gold, marble, ground, metal
            });

            var greenSomething = new PBRMesh(new TGCVector3(0.05f, 0.74f, 0.3f), 0.5f, 0.5f, scaling * TGCMatrix.Translation(0f, 100f, 400f), pbrMesh);
            var redRubber      = new PBRMesh(new TGCVector3(1f, 0.05f, 0.1f), 0.1f, 0.9f, scaling * TGCMatrix.Translation(0f, 100f, 300f), pbrMesh);
            var blueMetal      = new PBRMesh(new TGCVector3(0f, 0.2f, 1.0f), 0.75f, 0.3f, scaling * TGCMatrix.Translation(0f, 100f, -300f), pbrMesh);

            pbrMeshes.AddRange(new List <PBRMesh> {
                redRubber, blueMetal, greenSomething
            });
        }
Exemple #8
0
 public override void Dispose()
 {
     sphere.Dispose();
 }
Exemple #9
0
 public void Dispose()
 {
     BubbleTemplate.Dispose();
     Bubbles.ForEach(bubble => bubble.Dispose());
 }
Exemple #10
0
 public override void dispose()
 {
     mesh.Dispose();
 }
 public override void Dispose()
 {
     boundingSphere.Dispose();
     sphere.Dispose();
     shark.Dispose();
 }