Esempio n. 1
0
        public static GraphicResource From(GenericGraphicResource resBase, ContentRef <DrawTechnique> drawTechnique, ColorRgba color, bool isIndexed, ContentRef <Texture> paletteTexture)
        {
            GraphicResource res = new GraphicResource();

            res.FrameDuration = resBase.FrameDuration;
            res.FrameCount    = resBase.FrameCount;
            res.Base          = resBase;

            Material material = new Material(drawTechnique, color);

            material.SetTexture("mainTex", resBase.Texture);
            if (resBase.TextureNormal.IsAvailable)
            {
                material.SetTexture("normalTex", resBase.TextureNormal);
            }

            if (isIndexed)
            {
                material.SetTexture("paletteTex", paletteTexture);
            }

            res.Material = material;

            return(res);
        }
Esempio n. 2
0
        public static GraphicResource From(GenericGraphicResource resBase, string shader, ColorRgba color, bool isIndexed)
        {
            GraphicResource res = new GraphicResource();

            res.FrameDuration = resBase.FrameDuration;
            res.FrameCount    = resBase.FrameCount;
            res.Base          = resBase;

            res.AsyncFinalize = new GraphicResourceAsyncFinalize {
                Shader = shader,
                Color  = color,
                BindPaletteToMaterial = isIndexed
            };

            return(res);
        }