Example #1
0
        /// <summary>
        ///     Actualiza los parámetros de la caja en base a lo cargado por el usuario
        /// </summary>
        private void updateSphere()
        {
            var bTexture = useTextureModifier.Value;
            var color    = colorModifier.Value;

            sphere.RenderEdges = edgesModifier.Value;
            sphere.Inflate     = inflateModifier.Value;
            sphere.BasePoly    = (TGCSphere.eBasePoly)baseModifier.Value;

            if (bTexture)
            {
                //Cambiar textura
                var texturePath = textureModifier.Value;
                if (texturePath != currentTexture || !useTexture || (sphere.RenderEdges && sphere.Color != color))
                {
                    currentTexture = texturePath;
                    sphere.setColor(color);
                    sphere.setTexture(TgcTexture.createTexture(D3DDevice.Instance.Device, currentTexture));
                }
            }
            else
            {
                sphere.setColor(color);
            }

            useTexture = bTexture;

            //Radio, posición y color
            sphere.Radius        = radiusModifier.Value;
            sphere.Position      = positionModifier.Value;
            sphere.LevelOfDetail = (int)levelOfDetailModifier.Value;

            //Rotación, converitr a radianes
            var rotation = rotationModifier.Value;

            sphere.Rotation = new TGCVector3(Geometry.DegreeToRadian(rotation.X), Geometry.DegreeToRadian(rotation.Y), Geometry.DegreeToRadian(rotation.Z));

            //Offset de textura
            sphere.UVOffset = offsetModifier.Value;

            //Tiling de textura
            sphere.UVTiling = tilingModifier.Value;

            //Actualizar valores en la caja.
            sphere.updateValues();
        }