private void TestMosaics()
        {
            Vector2   size   = SpriteUtility.GetRealSize(output);
            Texture2D sTex   = source.sprite.texture;
            var       outTex = new Texture2D(sTex.width, sTex.height, format, sTex.mipmapCount > 0);

            GraphicUtility.Mosaics(sTex, ref outTex, mosaicSize);

            Vector2 pivot = new Vector2(0.5f, 0.5f);

            output.sprite = Sprite.Create(outTex, new Rect(0f, 0f, outTex.width, outTex.height), pivot);
            output.color  = Color.white;
            SpriteUtility.SetRealSize(output, size.x, size.y);
        }
Exemple #2
0
        public void ChangeGraphicColor(Color newColor)
        {
            if (color == newColor)
            {
                return;
            }

            if (graphicClass == typeof(MyGraphicCluster))
            {
                ChangeClusterGraphicsColor(newColor);
                return;
            }

            // If this is a Graphic_Cluster we mustnt change it's this.color or else we get an error
            color = newColor;

            //Log.Message("Correct function called");
            //if (this.cachedGraphic != null)
            //{
            //    string m = this.cachedGraphic.ToString();
            //    Log.Message(m);
            //}
            var cutout = shaderType;

            if (cutout == null)
            {
                cutout = ShaderTypeDefOf.Cutout;
            }

            var shader = cutout.Shader;

            cachedGraphic = GraphicDatabase.Get(graphicClass, texPath, shader, drawSize, color, color, this,
                                                shaderParameters);

            if (onGroundRandomRotateAngle > 0.01f)
            {
                cachedGraphic = new Graphic_RandomRotated(cachedGraphic, onGroundRandomRotateAngle);
            }

            if (Linked)
            {
                cachedGraphic = GraphicUtility.WrapLinked(cachedGraphic, linkType);
            }
        }
Exemple #3
0
        static SteamOverlayMats()
        {
            if (Estate_SteamAtlasGraphic == null)
            {
                var graphicData = new GraphicData();
                graphicData.graphicClass = typeof(Graphic_Single);
                graphicData.texPath      = "Things/Special/Power/Estate_SteamTransmitterAtlas";
                graphicData.linkFlags    = LinkFlags.Custom2;
                graphicData.shaderType   = ShaderTypeDefOf.MetaOverlay;
                Estate_SteamAtlasGraphic = graphicData.Graphic;
            }
            Graphic graphic = Estate_SteamAtlasGraphic;

            SteamOverlayMats.LinkedOverlayGraphic = GraphicUtility.WrapLinked(graphic, LinkDrawerType.TransmitterOverlay);
            graphic.data.linkFlags        = LinkFlags.Custom2;
            graphic.MatSingle.renderQueue = 3600;
            SteamOverlayMats.MatConnectorBase.renderQueue = 3600;
            SteamOverlayMats.MatConnectorLine.renderQueue = 3600;
        }
Exemple #4
0
        static NewPowerOverlayMats()
        {
            Graphic graphic = GraphicDatabase.Get <Graphic_Single>(NewPowerOverlayMats.TransmitterAtlasPath, NewPowerOverlayMats.TransmitterShader);

            NewPowerOverlayMats.LinkedOverlayGraphic = (Graphic_LinkedTransmitterOverlay)GraphicUtility.WrapLinked(graphic, LinkDrawerType.TransmitterOverlay);
            graphic.MatSingle.renderQueue            = 3600;
        }