Esempio n. 1
0
        /// <summary>
        ///     Actualiza los parámetros de la caja en base a lo cargado por el usuario
        /// </summary>
        private void updateBox()
        {
            //Cambiar textura
            var texturePath = (string)Modifiers["texture"];

            if (texturePath != currentTexture)
            {
                currentTexture = texturePath;
                box.setTexture(TgcTexture.createTexture(D3DDevice.Instance.Device, currentTexture));
            }

            //Tamaño, posición y color
            box.Size     = (Vector3)Modifiers["size"];
            box.Position = (Vector3)Modifiers["position"];
            box.Color    = (Color)Modifiers["color"];

            //Rotación, converitr a radianes
            var rotaion = (Vector3)Modifiers["rotation"];

            box.Rotation = new Vector3(Geometry.DegreeToRadian(rotaion.X), Geometry.DegreeToRadian(rotaion.Y),
                                       Geometry.DegreeToRadian(rotaion.Z));

            //Offset y Tiling de textura
            box.UVOffset = (Vector2)Modifiers["offset"];
            box.UVTiling = (Vector2)Modifiers["tiling"];

            //Actualizar valores en la caja.
            box.updateValues();
        }
Esempio n. 2
0
        /// <summary>
        ///     Actualiza los parametros de la caja en base a lo cargado por el usuario
        /// </summary>
        private void updateBox()
        {
            //Cambiar textura
            var texturePath = (string)Modifiers["texture"];

            if (texturePath != currentTexture)
            {
                currentTexture = texturePath;
                box.setTexture(TgcTexture.createTexture(D3DDevice.Instance.Device, currentTexture));
            }

            var size      = (Vector3)Modifiers["size"];
            var position  = (Vector3)Modifiers["position"];
            var thickness = (float)Modifiers["thickness"];
            var color     = (Color)Modifiers["color"];

            //Tamano, posicion y color
            box.Size     = size;
            box.Position = position + new Vector3(15f, 0, 0);
            box.Color    = color;

            //Actualizar valores en la caja.
            debugBox.setPositionSize(position - new Vector3(15f, 0, 0), size);
            debugBox.Thickness = thickness;
            debugBox.Color     = color;

            //Rotacion, converitr a radianes
            var rotaion = (Vector3)Modifiers["rotation"];

            box.Rotation = new Vector3(Geometry.DegreeToRadian(rotaion.X), Geometry.DegreeToRadian(rotaion.Y),
                                       Geometry.DegreeToRadian(rotaion.Z));

            //Offset y Tiling de textura
            box.UVOffset = (Vector2)Modifiers["offset"];
            box.UVTiling = (Vector2)Modifiers["tiling"];

            //Actualizar valores en la caja. IMPORTANTE, es mejor realizar transformaciones con matrices.
            debugBox.updateValues();
            //Actualizar valores en la caja. IMPORTANTE, es mejor realizar transformaciones con matrices.
            //Otra cosa importante, las rotaciones no modifican el AABB. con lo cual hay que tener cuidado.
            box.updateValues();
        }
Esempio n. 3
0
        private void changeBoxTexure(Device d3dDevice, TgcBox box, string texturePath)
        {
            TgcTexture t = TgcTexture.createTexture(d3dDevice, texturePath);

            box.setTexture(t);
        }
Esempio n. 4
0
 public override void setTexture(TgcTexture texture, int slot)
 {
     mesh.setTexture(texture);
 }