예제 #1
0
        public void SaveTexSampler(ResFileSaver saver, TexSampler sampler)
        {
            _filterFlags = sampler._filterFlags;

            WrapModeU       = ClampModes.FirstOrDefault(x => x.Value == sampler.ClampX).Key;
            WrapModeV       = ClampModes.FirstOrDefault(x => x.Value == sampler.ClampY).Key;
            WrapModeW       = ClampModes.FirstOrDefault(x => x.Value == sampler.ClampZ).Key;
            CompareFunc     = CompareModes.FirstOrDefault(x => x.Value == sampler.DepthCompareFunc).Key;
            BorderColorType = BorderModes.FirstOrDefault(x => x.Value == sampler.BorderType).Key;
            Anisotropic     = AnisotropicModes.FirstOrDefault(x => x.Value == sampler.MaxAnisotropicRatio).Key;
            Mipmap          = MipFilters.FirstOrDefault(x => x.Value == sampler.MipFilter).Key;
            ExpandXY        = ExpandFilters.FirstOrDefault(x => x.Value == sampler.MagFilter).Key;
            ShrinkXY        = ShrinkFilters.FirstOrDefault(x => x.Value == sampler.MinFilter).Key;

            /*   _filterFlags = 0x0029;
             *
             * ShrinkXY = ShrinkFilterModes.Linear;
             * ExpandXY = ExpandFilterModes.Linear;
             * Mipmap = MipFilterModes.Points;
             * BorderColorType = TexBorderType.White;*/

            MinLOD  = sampler.MinLod;
            MaxLOD  = sampler.MaxLod;
            LODBias = sampler.LodBias;

            ((IResData)this).Save(saver);
        }
예제 #2
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        public TexSampler ToTexSampler()
        {
            TexSampler sampler = new TexSampler();

            sampler._filterFlags = _filterFlags;

            if (ClampModes.ContainsKey(WrapModeU))
            {
                sampler.ClampX = ClampModes[WrapModeU];
            }
            if (ClampModes.ContainsKey(WrapModeV))
            {
                sampler.ClampY = ClampModes[WrapModeV];
            }
            if (ClampModes.ContainsKey(WrapModeW))
            {
                sampler.ClampZ = ClampModes[WrapModeW];
            }
            if (AnisotropicModes.ContainsKey(Anisotropic))
            {
                sampler.MaxAnisotropicRatio = AnisotropicModes[Anisotropic];
            }
            if (CompareModes.ContainsKey(CompareFunc))
            {
                sampler.DepthCompareFunc = CompareModes[CompareFunc];
            }
            if (BorderModes.ContainsKey(BorderColorType))
            {
                sampler.BorderType = BorderModes[BorderColorType];
            }

            if (MipFilters.ContainsKey(Mipmap))
            {
                sampler.MipFilter = MipFilters[Mipmap];
            }
            if (ExpandFilters.ContainsKey(ExpandXY))
            {
                sampler.MagFilter = ExpandFilters[ExpandXY];
            }
            if (ShrinkFilters.ContainsKey(ShrinkXY))
            {
                sampler.MinFilter = ShrinkFilters[ShrinkXY];
            }

            sampler.MaxLod  = MaxLOD;
            sampler.MinLod  = MinLOD;
            sampler.LodBias = LODBias;

            return(sampler);
        }