Example #1
0
        private static void SetSamplerInformation(RMaterial material, MatlAttribute a)
        {
            var samplerStruct = (MatlAttribute.MatlSampler)a.DataObject;

            SamplerObject sampler = new SamplerObject
            {
                TextureWrapS = MatlToGl.GetWrapMode(samplerStruct.WrapS),
                TextureWrapT = MatlToGl.GetWrapMode(samplerStruct.WrapT),
                TextureWrapR = MatlToGl.GetWrapMode(samplerStruct.WrapR),
                MagFilter    = MatlToGl.GetMagFilter(samplerStruct.MagFilter),
                MinFilter    = MatlToGl.GetMinFilter(samplerStruct.MinFilter)
            };

            GL.SamplerParameter(sampler.Id, SamplerParameterName.TextureLodBias, samplerStruct.LodBias);

            if (samplerStruct.Unk6 == 2 && RenderSettings.Instance.EnableExperimental)
            {
                GL.SamplerParameter(sampler.Id, SamplerParameterName.TextureMaxAnisotropyExt, (float)samplerStruct.MaxAnisotropy);
            }
            else
            {
                GL.SamplerParameter(sampler.Id, SamplerParameterName.TextureMaxAnisotropyExt, 1.0f);
            }

            material.samplerByParamId[a.ParamId] = sampler;
        }
Example #2
0
        private static void SetRasterizerState(RMaterial meshMaterial, MatlAttribute a)
        {
            var rasterizerState = (MatlAttribute.MatlRasterizerState)a.DataObject;

            meshMaterial.DepthBias = rasterizerState.DepthBias;
            meshMaterial.CullMode  = MatlToGl.GetCullMode(rasterizerState.CullMode);
        }