Пример #1
0
 public TextureLink(ModularTextureData Texture, ModularTextureArray Array, ModularPlacableObject ModularPlacable, Utils.RenderSet Set, int SetID)
 {
     this._Texture        = Texture;
     this._Array          = Array;
     this.ModularPlacable = ModularPlacable;
     AddRenderTuple(Set, SetID);
 }
Пример #2
0
 public void UpdateTextures(ModularTextureData Last)
 {
     MonoBehaviour.print("Harro");
     for (int i = 0; i < Tuples.Count; i++)
     {
         ApplyTextureData(Tuples[i].RenderSet.Sets[Tuples[i].SetID].Renderer, Texture);
     }
     ModularPlacable.RefillColorLinks();
 }
Пример #3
0
            public void ApplyTextureData(Renderer Renderer, ModularTextureData Texture)
            {
                MaterialPropertyBlock Block = new MaterialPropertyBlock();

                // set texture properties
                if (Texture.Albedo != null)
                {
                    Block.SetTexture("_MainTex", Texture.Albedo);
                }
                if (Texture.MGA != null)
                {
                    Block.SetTexture("_Metallic", Texture.MGA);
                }
                if (Texture.NormalMap != null)
                {
                    Block.SetTexture("_BumpMap", Texture.NormalMap);
                }
                if (Texture.Emissive != null)
                {
                    Block.SetTexture("_EmissionMap", Texture.Emissive);
                }
                if (Texture.ColorMask != null)
                {
                    Block.SetTexture("_ColorMask", Texture.ColorMask);
                }
                else
                {
                    Texture2D BlankTexture = new Texture2D(1, 1);
                    BlankTexture.SetPixel(0, 0, Color.red);
                    BlankTexture.Apply();
                    Block.SetTexture("_ColorMask", BlankTexture);
                }

                // Set values
                Block.SetFloat("_Glossiness", Texture.Smoothness);
                Block.SetFloat("_AdditionalGlossiness", Texture.AdditionalSmoothness);
                Block.SetFloat("_AmbientStrength", Texture.AmbientOcclusion);
                Block.SetFloat("_EmissiveBrightness", Texture.EmissiveBrightness);
                Block.SetVector("_EmissionColor", Texture.EmissiveColor);

                // Set mask values
                Block.SetFloat("_ColorMaskCount", Texture._ColorMaskCount);

                for (int i = 0; i < Texture._ColorMaskCount; i++)
                {
                    Block.SetVector("_MaskColor" + (i + 1), Texture._MaskColors[i]);
                    Block.SetVector("_CounterColor" + (i + 1), Texture._AverageColors[i]);
                }

                Renderer.SetPropertyBlock(Block);
            }
 protected override void RefillTextureLinks()
 {
     base.RefillTextureLinks();
     if (UseTextureArray)
     {
         List <Utils.RenderSet.Set> RenderSets = RenderSet.Sets;
         List <TextureLink>         Links      = new List <TextureLink> ();
         for (int i = 0; i < RenderSets.Count; i++)
         {
             if (TextureKeys.Length <= i || !Management.GameManager.I.Modular.TextureDataDictionary.ContainsKey(TextureKeys [i]))
             {
                 continue;
             }
             ModularTextureData Texture = Management.GameManager.I.Modular.TextureDataDictionary [TextureKeys [i]];
             TextureLink        Link    = new TextureLink(Texture, TextureArrays [i].TextureArray, this, RenderSet, i);
             Link.ApplyTextureData(RenderSets[i].Renderer, Texture);
             Links.Add(Link);
         }
         Textures = Links;
     }
 }
Пример #5
0
 public TextureGroup(TextureLink link, ModularTextureArray TextureArray)
 {
     this._Texture      = link._Texture;
     this._TextureArray = TextureArray;
     this.Links.Add(link);
 }