Ejemplo n.º 1
0
        /// <summary>
        /// Libera los recursos de la malla
        /// </summary>
        public void dispose()
        {
            this.enabled = false;
            if (boundingBox != null)
            {
                boundingBox.dispose();
            }

            //dejar de utilizar originalData
            originalData = null;

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

            //hacer dispose de instancias
            foreach (TgcSkeletalMesh 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++)
                {
                    diffuseMaps[i].dispose();
                }
                diffuseMaps = null;
            }

            //Dispose de Box de joints
            if (skeletonRenderJoints != null)
            {
                foreach (TgcBox jointBox in skeletonRenderJoints)
                {
                    jointBox.dispose();
                }
                skeletonRenderJoints = null;
            }

            //Dispose de lineas de Bones
            if (skeletonRenderBones != null)
            {
                foreach (TgcLine boneLine in skeletonRenderBones)
                {
                    if (boneLine != null)
                    {
                        boneLine.dispose();
                    }
                }
                skeletonRenderBones = null;
            }

            //Liberar attachments
            foreach (TgcSkeletalBoneAttach attach in attachments)
            {
                attach.Mesh.dispose();
            }
            attachments = null;

            //VertexDeclaration
            vertexDeclaration.Dispose();
            vertexDeclaration = null;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Crea una nueva malla.
 /// </summary>
 /// <param name="mesh">Mesh de DirectX</param>
 /// <param name="renderType">Formato de renderizado de la malla</param>
 /// <param name="origData">Datos originales de la malla que hay almacenar</param>
 /// <param name="bones">Datos de los huesos</param>
 /// <param name="verticesWeights">Datos de los Weights para cada vertice</param>
 public TgcSkeletalMesh(Mesh mesh, string name, MeshRenderType renderType, OriginalData origData, TgcSkeletalBone[] bones, TgcSkeletalVertexWeight[] verticesWeights)
 {
     this.initData(mesh, name, renderType, origData, bones, verticesWeights);
 }
 public void TestInitialize()
 {
     this._element = new OriginalData();
     this._provider = this._element;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Cargar datos iniciales
        /// </summary>
        protected void initData(Mesh mesh, string name, MeshRenderType renderType, OriginalData originalData, TgcSkeletalBone[] bones, TgcSkeletalVertexWeight[] verticesWeights)
        {
            this.d3dMesh = mesh;
            this.name = name;
            this.renderType = renderType;
            this.originalData = originalData;
            this.enabled = false;
            this.autoUpdateBoundingBox = true;
            this.bones = bones;
            this.verticesWeights = verticesWeights;
            this.attachments = new List<TgcSkeletalBoneAttach>();
            this.meshInstances = new List<TgcSkeletalMesh>();
            this.renderSkeleton = false;
            this.alphaBlendEnable = false;

            //Crear vertexDeclaration
            vertexDeclaration = new VertexDeclaration(mesh.Device, mesh.Declaration);

            //variables de movimiento
            this.autoTransformEnable = true;
            this.translation = new Vector3(0f, 0f, 0f);
            this.rotation = new Vector3(0f, 0f, 0f);
            this.scale = new Vector3(1f, 1f, 1f);
            this.transform = Matrix.Identity;

            //variables de animacion
            this.isAnimating = false;
            this.currentAnimation = null;
            this.playLoop = false;
            this.frameRate = 0f;
            this.currentTime = 0f;
            this.animationTimeLenght = 0f;
            this.currentFrame = 0;
            this.animations = new Dictionary<string, TgcSkeletalAnimation>();

            //acomodar huesos
            setupSkeleton();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Libera los recursos de la malla
        /// </summary>
        public void dispose()
        {
            this.enabled = false;
            if (boundingBox != null)
            {
                boundingBox.dispose();
            }

            //dejar de utilizar originalData
            originalData = null;

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

            //hacer dispose de instancias
            foreach (TgcKeyFrameMesh 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++)
                {
                    diffuseMaps[i].dispose();
                }
                diffuseMaps = null;
            }

            //VertexDeclaration
            vertexDeclaration.Dispose();
            vertexDeclaration = null;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Crea una nueva malla.
 /// </summary>
 /// <param name="mesh">Mesh de DirectX</param>
 /// <param name="renderType">Formato de renderizado de la malla</param>
 /// <param name="coordinatesIndices">Datos parseados de la malla</param>
 public TgcKeyFrameMesh(Mesh mesh, string name, MeshRenderType renderType, OriginalData originalData)
 {
     this.initData(mesh, name, renderType, originalData);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Cargar datos iniciales
        /// </summary>
        private void initData(Mesh mesh, string name, MeshRenderType renderType, OriginalData originalData)
        {
            this.d3dMesh = mesh;
            this.name = name;
            this.renderType = renderType;
            this.originalData = originalData;
            this.enabled = false;
            this.autoUpdateBoundingBox = true;
            this.meshInstances = new List<TgcKeyFrameMesh>();
            this.alphaBlendEnable = false;

            vertexDeclaration = new VertexDeclaration(mesh.Device, mesh.Declaration);

            //variables de movimiento
            this.autoTransformEnable = true;
            this.translation = new Vector3(0f, 0f, 0f);
            this.rotation = new Vector3(0f, 0f, 0f);
            this.scale = new Vector3(1f, 1f, 1f);
            this.transform = Matrix.Identity;

            //variables de animacion
            this.isAnimating = false;
            this.currentAnimation = null;
            this.playLoop = false;
            this.currentTime = 0f;
            this.currentFrame = 0;
            this.animationTimeLenght = 0f;
            this.animations = new Dictionary<string, TgcKeyFrameAnimation>();
        }
        public void DefaultValue_OriginalData()
        {
            OriginalData data;

            data = new OriginalData();
            Assert.IsNotNull(data.DataElements, "DataElements is null.");
            Assert.AreEqual(0, data.DataElements.Count, "DataElements count is incorrect.");
            Assert.IsFalse(data.HasData, "HasData is incorrect.");
        }
Ejemplo n.º 9
0
 public void TestInitialize()
 {
     this._element  = new OriginalData();
     this._provider = this._element;
 }
Ejemplo n.º 10
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("THTokenInfo(");
            bool          __first = true;

            if (ReferrerUserId != null && __isset.referrerUserId)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("ReferrerUserId: ");
                __sb.Append(ReferrerUserId);
            }
            if (Token != null && __isset.token)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Token: ");
                __sb.Append(Token);
            }
            if (Provider != null && __isset.provider)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Provider: ");
                __sb.Append(Provider);
            }
            if (__isset.firstMatch)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("FirstMatch: ");
                __sb.Append(FirstMatch);
            }
            if (LinkParams != null && __isset.linkParams)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("LinkParams: ");
                __sb.Append(LinkParams.ToDebugString());
            }
            if (InternalData != null && __isset.internalData)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("InternalData: ");
                __sb.Append(InternalData.ToDebugString());
            }
            if (__isset.guaranteedMatch)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("GuaranteedMatch: ");
                __sb.Append(GuaranteedMatch);
            }
            if (OriginalData != null && __isset.originalData)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("OriginalData: ");
                __sb.Append(OriginalData.ToDebugString());
            }
            if (Debug != null && __isset.debug)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Debug: ");
                __sb.Append(Debug);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
Ejemplo n.º 11
0
 public List <string> GetDeltaFields()
 {
     return(Data.Where(x => !OriginalData.ContainsKey(x.Key) ||
                       !OriginalData[x.Key].Equals(x.Value)).Select(x => x.Key).ToList());
 }