public CubemapWrapper(string value, Texture2D[] textures, TextureTypeEnum cubeType, bool mipmaps, bool readable)
        {
            this.name = value;
            type      = cubeType == TextureTypeEnum.RGB2_CubeMap? TextureTypeEnum.RGB2_CubeMap : TextureTypeEnum.CubeMap;
            KSPLog.print("[EVE] Creating " + name + " Cubemap");

            foreach (Texture2D tex in textures)
            {
                tex.wrapMode = TextureWrapMode.Clamp;
            }

            if (type == TextureTypeEnum.RGB2_CubeMap)
            {
                texPositive = textures[0];
                texNegative = textures[1];
            }
            else
            {
                /*
                 * cubeTex = new Cubemap(textures[0].width, TextureFormat.RGBA32, mipmaps);
                 *
                 * foreach (CubemapFace face in Enum.GetValues(typeof(CubemapFace)))
                 * {
                 *  Texture2D tex = textures[(int)face];
                 *  cubeTex.SetPixels(tex.GetPixels(), face);
                 * }
                 * cubeTex.Apply(mipmaps, !readable);
                 * cubeTex.SmoothEdges();
                 */
                texList = textures;
            }
        }
Ejemplo n.º 2
0
 public AddSkin(TextureTypeEnum currentTextureType)
 {
     //default texture selection should be front and back
     _currentTextureType = currentTextureType == TextureTypeEnum.None? TextureTypeEnum.FrontAndBack : currentTextureType;
     InitializeComponent();
     Loaded += AddSkinLoaded;
 }
        public CubemapWrapper(string value, Texture2D[] textures, TextureTypeEnum cubeType, bool mipmaps, bool readable)
        {
            this.name = value;
            type = cubeType == TextureTypeEnum.RGB2_CubeMap? TextureTypeEnum.RGB2_CubeMap : TextureTypeEnum.CubeMap;
            KSPLog.print("Creating " + name + " Cubemap");

            foreach (Texture2D tex in textures)
            {
                tex.wrapMode = TextureWrapMode.Clamp;
            }

            if (type == TextureTypeEnum.RGB2_CubeMap)
            {
                texPositive = textures[0];
                texNegative = textures[1];
            }
            else
            {
                /*
                cubeTex = new Cubemap(textures[0].width, TextureFormat.RGBA32, mipmaps);
                
                foreach (CubemapFace face in Enum.GetValues(typeof(CubemapFace)))
                {
                    Texture2D tex = textures[(int)face];
                    cubeTex.SetPixels(tex.GetPixels(), face);
                }
                cubeTex.Apply(mipmaps, !readable);
                cubeTex.SmoothEdges();
                */
                texList = textures;
                
            }
        }
Ejemplo n.º 4
0
        private void SetNoTextureDisplay()
        {
            var color = Colors.Gray;

            _currentTextureBitmap  = GetSingleColorTextureBitmap(color.R, color.G, color.B);
            _currentTextureType    = TextureTypeEnum.None;
            _currentModel.Material = new DiffuseMaterial(Brushes.Gray);
            UpdateModelDisplay(_currentModel);
        }
Ejemplo n.º 5
0
        private void AddSkinButtonClicked(object sender, RoutedEventArgs e)
        {
            const string changeSkinText = "Change Skin";
            const string addSkinText    = "Add Skin";

            var skinWindow = new AddSkin(_currentTextureType);
            var result     = skinWindow.ShowDialog();

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            var selectedParams = skinWindow.ReturnValue;

            switch (selectedParams.Item1)
            {
            case 0:
                Generate2CornerTexture();
                ApplyTextureOnCurrentModel(_2CornerTextureAndBitmap);
                AddSkinTextBox.Text = changeSkinText;
                _currentTextureType = TextureTypeEnum.FrontAndBack;
                break;

            case 1:
                Generate4CornerTexture();
                ApplyTextureOnCurrentModel(_4CornerTextureAndBitmap);
                AddSkinTextBox.Text = changeSkinText;
                _currentTextureType = TextureTypeEnum.FourCorners;
                break;

            case 2:
                Generate8CornerTexture();
                ApplyTextureOnCurrentModel(_8CornerTextureAndBitmap);
                AddSkinTextBox.Text = changeSkinText;
                _currentTextureType = TextureTypeEnum.EightCorners;
                break;

            case 3:
                _currentTextureBitmap  = GetSingleColorTextureBitmap(selectedParams.Item2, selectedParams.Item3, selectedParams.Item4);
                _currentModel.Material = GetMaterial(_currentTextureBitmap);
                UpdateModelDisplay(_currentModel);
                AddSkinTextBox.Text = changeSkinText;
                _currentTextureType = TextureTypeEnum.SingleColor;
                break;

            case 4:
                SetNoTextureDisplay();
                AddSkinTextBox.Text = addSkinText;
                break;
            }

            AdjustSkinButton.Visibility = _currentTextureType == TextureTypeEnum.FourCorners && ThreeOrMoreImagesExist() ? Visibility.Visible : Visibility.Collapsed;
        }
Ejemplo n.º 6
0
        // Token: 0x06000036 RID: 54 RVA: 0x00003890 File Offset: 0x00002490
        public PixelFormat GetPixelFormat()
        {
            TextureTypeEnum type = this.Type;

            if (type == TextureTypeEnum.Indexed_8bit)
            {
                return(PixelFormat.Format8bppIndexed);
            }
            if (type == TextureTypeEnum.Indexed_4bit)
            {
                return(PixelFormat.Format4bppIndexed);
            }
            throw new NotSupportedException(string.Format("Not supported texture type 0x{0:X}", this.TypeBinary));
        }
Ejemplo n.º 7
0
        // Token: 0x0600003A RID: 58 RVA: 0x000039DC File Offset: 0x000025DC
        public void ApplyBitmapData(Bitmap bitmap, Dictionary <Color, int> indexByColor)
        {
            TextureTypeEnum type = this.Type;

            if (type == TextureTypeEnum.Indexed_8bit)
            {
                this.ApplyBitmap8bit(bitmap, indexByColor);
                return;
            }
            if (type == TextureTypeEnum.Indexed_4bit)
            {
                this.ApplyBitmap4bit(bitmap, indexByColor);
                return;
            }
            throw new NotSupportedException(string.Format("Not supported texture type 0x{0:X}", this.TypeBinary));
        }
Ejemplo n.º 8
0
        // Token: 0x06000037 RID: 55 RVA: 0x000038D4 File Offset: 0x000024D4
        public void ApplyTextureData(Bitmap bitmap, Dictionary <int, Color> palette)
        {
            TextureTypeEnum type = this.Type;

            if (type == TextureTypeEnum.Indexed_8bit)
            {
                this.Apply8bit(bitmap, palette);
                return;
            }
            if (type == TextureTypeEnum.Indexed_4bit)
            {
                this.Apply4bit(bitmap, palette);
                return;
            }
            throw new NotSupportedException(string.Format("Not supported texture type 0x{0:X}", this.TypeBinary));
        }
 public static void GenerateCubemapWrapper(string value, Texture2D[] textures, TextureTypeEnum cubeType, bool mipmaps, bool readable)
 {
     CubemapList[value] = new CubemapWrapper(value, textures, cubeType, mipmaps, readable);
 }
 public TextureType(TextureTypeEnum type)
 {
     Type = type;
 }
 internal static bool Exists(string value, TextureTypeEnum type)
 {
     //Only the one type supported for now
     return(CubemapList.ContainsKey(value)); // && CubemapList[value].type == type);
 }
 public TextureType(TextureTypeEnum type)
 {
     Type = type;
 }
 internal static bool Exists(string value, TextureTypeEnum type)
 {
     //Only the one type supported for now
     return (CubemapList.ContainsKey(value));// && CubemapList[value].type == type);
 }
 public static void GenerateCubemapWrapper(string value, Texture2D[] textures, TextureTypeEnum cubeType, bool mipmaps, bool readable)
 {
     CubemapList[value] = new CubemapWrapper(value, textures, cubeType, mipmaps, readable);
 }