public override void set(KSPTextureInfo info)
            {
                _main = new TextureInfo();
                _main.texture = info.mainTexture;
                _main.url = info.mainUrl;

                if (info.hasNormalMap)
                {
                    _normalMap = new TextureInfo();
                    _normalMap.texture = info.normalMapTexture;
                    _normalMap.url = info.normalMapUrl;
                    _normalMap.normalMap = true;
                    _hasNormalMap = true;
                }
                else
                {
                    _normalMap = null;
                    _hasNormalMap = false;
                }
            }
예제 #2
0
 public abstract void set(KSPTextureInfo info);
            public override void set(KSPTextureInfo info)
            {
                string[] textureNamesArray = Utils.SplitString(_textureNames);
                string[] normalMapNamesArray = Utils.SplitString(_normalMapNames);

                string dirUrl = info.dirUrl;
                if (_textureDir != string.Empty) dirUrl = _textureDir;

                _mainTextInfo = new List<TextureInfo>();
                for (int i = 0; i < textureNamesArray.Length; ++i)
                {
                    TextureInfo texInfo = new TextureInfo();
                    texInfo.url = dirUrl + "/" + textureNamesArray[i];
                    texInfo.name = System.IO.Path.GetFileNameWithoutExtension(texInfo.url);
                    _mainTextInfo.Add(texInfo);
                }

                _normalTextInfo = new List<TextureInfo>();
                for (int i = 0; i < normalMapNamesArray.Length; ++i)
                {
                    TextureInfo texInfo = new TextureInfo();
                    texInfo.url = dirUrl + "/" + normalMapNamesArray[i];
                    texInfo.name = System.IO.Path.GetFileNameWithoutExtension(texInfo.url);
                    texInfo.normalMap = true;
                    _normalTextInfo.Add(texInfo);
                }

                if (_normalTextInfo.Count > 0) _hasNormalMap = true;
                else _hasNormalMap = false;

                if (_mainTextInfo.Count == 0)
                {
                    valid = false;
                    Utils.LogError("no main textures");
                    return;
                }

                if (_hasNormalMap && _mainTextInfo.Count != _normalTextInfo.Count)
                {
                    Utils.LogError("different numbers of mainTextures ({0}) and normalMaps ({1})", _mainTextInfo.Count, _normalTextInfo.Count);
                    valid = false;
                    return;
                }

                if (Global.Debug2) Utils.Log("valid multiple base texture, textures: {0}", _mainTextInfo.Count);

                valid = true;
            }