private void Start()
        {
            IPackImage[] imgs = new IPackImage[_textures.Length];

            for (int i = 0; i < _textures.Length; i++)
            {
                imgs[i] = new PackImage(_textures[i]);
            }

            // Create dummy images.
            //
            // int min = 10;
            // int max = 50;
            // int count = 955;
            // IPackImage[] imgs = new IPackImage[count];
            // for (int i = 0; i < imgs.Length; i++)
            // {
            //     imgs[i] = new DummyPackImage(Random.Range(min, max), Random.Range(min, max), Random.ColorHSV());
            // };

            _packer        = new Packer(_material);
            _packerService = new PackService(_packer);
            _infos         = _packerService.PackImages(imgs);

            // Show a packed texture as preview.
            _tex = _packerService.GetPackedImage();

            _targetMaterial             = _target.GetComponent <Renderer>().material;
            _targetMaterial.mainTexture = _tex;

            ShowTex(0);
        }
Beispiel #2
0
        public SelImage(IAttrRow iRowImage)
        {
            s_pW = this;
            m_iRowImage = iRowImage;
            m_mapLocalRes = new Dictionary<string, TreeViewItem>();
            m_mapOtherRes = new Dictionary<string, TreeViewItem>();
            m_mapPngItem = new Dictionary<string, TreeViewItem>();
            InitializeComponent();
            this.Owner = MainWindow.s_pW;

            m_curTgaCtrl = null;
            m_curImg = null;
            ImageIndex.refreshImageIndex();
            refreshResMap();
            refreshResTree();
        }
Beispiel #3
0
        private void showPackImage(TreeViewItem tgaItem, string pngName = null)
        {
            string tgaPath = Project.Setting.s_imagePath + "\\" + tgaItem.Header.ToString() + ".xml";

            m_curTgaCtrl = new PackImage(tgaPath, false);

            mx_imgFrame.Children.Clear();
            mx_imgFrame.Width = m_curTgaCtrl.m_imageWidth;
            mx_imgFrame.Height = m_curTgaCtrl.m_imageHeight;
            m_curTgaCtrl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            m_curTgaCtrl.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            mx_imgFrame.Children.Add(m_curTgaCtrl);

            m_curTgaCtrl.m_curPngName = pngName;
        }