static void LoadProperties(TexSampler sampler)
        {
            var flags = ImGuiTreeNodeFlags.DefaultOpen;

            if (ImGui.CollapsingHeader("Wrap Mode", flags))
            {
                ImGuiHelper.ComboFromEnum <GX2TexClamp>("Wrap X", sampler, "ClampX");
                ImGuiHelper.ComboFromEnum <GX2TexClamp>("Wrap Y", sampler, "ClampY");
                ImGuiHelper.ComboFromEnum <GX2TexClamp>("Wrap Z", sampler, "ClampZ");
            }
            if (ImGui.CollapsingHeader("Filter", flags))
            {
                ImGuiHelper.ComboFromEnum <GX2TexXYFilterType>("Mag Filter", sampler, "MagFilter");
                ImGuiHelper.ComboFromEnum <GX2TexXYFilterType>("Min Filter", sampler, "MinFilter");
                ImGuiHelper.ComboFromEnum <GX2TexZFilterType>("Z Filter", sampler, "ZFilter");
                ImGuiHelper.ComboFromEnum <GX2TexMipFilterType>("Mip Filter", sampler, "MipFilter");
                ImGuiHelper.ComboFromEnum <GX2TexAnisoRatio>("Anisotropic Ratio", sampler, "MaxAnisotropicRatio");
            }
            if (ImGui.CollapsingHeader("Mip LOD", flags))
            {
                ImGuiHelper.InputFromFloat("Lod Min", sampler, "MinLod", false, 1);
                ImGuiHelper.InputFromFloat("Lod Max", sampler, "MaxLod", false, 1);
                ImGuiHelper.InputFromFloat("Lod Bias", sampler, "LodBias", false, 1);
            }
            if (ImGui.CollapsingHeader("Depth", flags))
            {
                ImGuiHelper.InputFromBoolean("Depth Enabled", sampler, "DepthCompareEnabled");
                ImGuiHelper.ComboFromEnum <GX2CompareFunction>("Depth Compare", sampler, "DepthCompareFunc");
            }
            if (ImGui.CollapsingHeader("Border", flags))
            {
                ImGuiHelper.ComboFromEnum <GX2TexBorderType>("Border Type", sampler, "BorderType");
            }
        }
Exemplo n.º 2
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;
            // ShrinkXY = ShrinkFilterModes.Linear;
            //   ExpandXY = ExpandFilterModes.Linear;
            //  Mipmap = MipFilters.FirstOrDefault(x => x.Value == sampler.MipFilter).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);
        }
Exemplo n.º 3
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            TexSampler = new TexSampler(loader.ReadUInt32s(3));
            uint handle = loader.ReadUInt32();

            Name = loader.LoadString();
            byte idx = loader.ReadByte();

            loader.Seek(3);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 void IResData.Load(ResFileLoader loader)
 {
     if (loader.IsSwitch)
     {
         sampler = new SamplerSwitch();
         ((IResData)sampler).Load(loader);
         TexSampler = sampler.ToTexSampler();
     }
     else
     {
         TexSampler = new TexSampler(loader.ReadUInt32s(3));
         uint handle = loader.ReadUInt32();
         Name = loader.LoadString();
         byte idx = loader.ReadByte();
         loader.Seek(3);
     }
 }