protected virtual object EvalSampler_State_Expression(ParseTree tree, params object[] paramlist) { var sampler = paramlist[0] as SamplerStateInfo; var name = this.GetValue(tree, TokenType.Identifier, 0) as string; var value = (this.GetValue(tree, TokenType.Identifier, 1) ?? (this.GetValue(tree, TokenType.Identifier, 2) ?? this.GetValue(tree, TokenType.Number, 0))) as string; switch (name.ToLower()) { case "texture": sampler.textureName = value; break; case "minfilter": sampler.MinFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "magfilter": sampler.MagFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "mipfilter": sampler.MipFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "filter": sampler.MinFilter = sampler.MagFilter = sampler.MipFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "addressu": sampler.state.AddressU = ParseTreeTools.ParseAddressMode(value); break; case "addressv": sampler.state.AddressV = ParseTreeTools.ParseAddressMode(value); break; case "addressw": sampler.state.AddressW = ParseTreeTools.ParseAddressMode(value); break; case "maxanisotropy": sampler.state.MaxAnisotropy = int.Parse(value); break; case "maxlod": sampler.state.MaxMipLevel = int.Parse(value); break; case "miplodbias": sampler.state.MipMapLevelOfDetailBias = float.Parse(value); break; default: break; } return(null); }
public void Parse(string name, string value) { switch (name.ToLower()) { case "texture": TextureName = value; break; case "minfilter": MinFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "magfilter": MagFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "mipfilter": MipFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "filter": MinFilter = MagFilter = MipFilter = ParseTreeTools.ParseTextureFilterType(value); break; case "addressu": AddressU = ParseTreeTools.ParseAddressMode(value); break; case "addressv": AddressV = ParseTreeTools.ParseAddressMode(value); break; case "addressw": AddressW = ParseTreeTools.ParseAddressMode(value); break; case "maxanisotropy": MaxAnisotropy = int.Parse(value); break; case "maxlod": MaxMipLevel = int.Parse(value); break; case "miplodbias": MipMapLevelOfDetailBias = float.Parse(value); break; } }