public void ReloadTextureMap(int index) { var texSampler = Material.Samplers[index].TexSampler; var texMap = this.TextureMaps[index]; texMap.MagFilter = GXConverter.ConvertMagFilter(texSampler.MagFilter); texMap.MinFilter = GXConverter.ConvertMinFilter( texSampler.MipFilter, texSampler.MinFilter); texMap.WrapU = GXConverter.ConvertWrapMode(texSampler.ClampX); texMap.WrapV = GXConverter.ConvertWrapMode(texSampler.ClampY); texMap.LODBias = texSampler.LodBias; texMap.MaxLOD = texSampler.MaxLod; texMap.MinLOD = texSampler.MinLod; }
public void UpdateRenderState() { GXConverter.ConvertRenderState(this, Material.RenderState); GXConverter.ConvertPolygonState(this, Material); if (this.BlendState.State == GLMaterialBlendState.BlendState.Translucent || this.BlendState.State == GLMaterialBlendState.BlendState.Custom) { Icon = "/Images/MaterialTrans.tif"; } if (this.BlendState.State == GLMaterialBlendState.BlendState.Mask) { Icon = "/Images/MaterialMask.tif"; } }
public void Reload(Material material) { ShaderArchive = ""; ShaderModel = ""; ShaderParams.Clear(); ShaderOptions.Clear(); Samplers.Clear(); TextureMaps.Clear(); UpdateRenderState(); if (material.ShaderAssign != null) { ShaderArchive = material.ShaderAssign.ShaderArchiveName; ShaderModel = material.ShaderAssign.ShadingModelName; } foreach (var param in material.ShaderParams) { ShaderParams.Add(param.Key, param.Value); } foreach (var option in material.ShaderAssign.ShaderOptions) { ShaderOptions.Add(option.Key, option.Value); } // if (ShaderParams.ContainsKey("gsys_i_color_ratio0")) // ShaderParams["gsys_i_color_ratio0"].DataValue = 0.1f; for (int i = 0; i < material.TextureRefs.Count; i++) { string name = material.TextureRefs[i].Name; Sampler sampler = material.Samplers[i]; var texSampler = material.Samplers[i].TexSampler; string samplerName = sampler.Name; string fragSampler = ""; //Force frag shader sampler to be used if (material.ShaderAssign.SamplerAssigns.ContainsValue(samplerName)) { material.ShaderAssign.SamplerAssigns.TryGetKey(samplerName, out fragSampler); } Samplers.Add(fragSampler); this.TextureMaps.Add(new TextureMap() { Name = name, Sampler = samplerName, MagFilter = GXConverter.ConvertMagFilter(texSampler.MagFilter), MinFilter = GXConverter.ConvertMinFilter( texSampler.MipFilter, texSampler.MinFilter), Type = GetTextureType(fragSampler), WrapU = GXConverter.ConvertWrapMode(texSampler.ClampX), WrapV = GXConverter.ConvertWrapMode(texSampler.ClampY), LODBias = texSampler.LodBias, MaxLOD = texSampler.MaxLod, MinLOD = texSampler.MinLod, }); } }