Exemplo n.º 1
0
 protected Kn5MaterialDeferred(EffectDeferredGObject.Material material, bool isBlending) {
     _material = material;
     IsBlending = isBlending;
 }
Exemplo n.º 2
0
        public void Initialize(DeviceContextHolder contextHolder) {
            _effect = contextHolder.GetEffect<EffectDeferredGObject>();

            if (_kn5Material == null) return;

            _txDiffuse = GetTexture("txDiffuse", contextHolder);
            _txNormal = _kn5Material.ShaderName.Contains("damage") ? null : GetTexture("txNormal", contextHolder);
            _txMaps = GetTexture("txMaps", contextHolder);
            _txDetails = GetTexture("txDetail", contextHolder);
            _txDetailsNormal = GetTexture("txNormalDetail", contextHolder);

            uint flags = 0;

            if (_txNormal != null) {
                flags |= EffectDeferredGObject.HasNormalMap;
            }

            if (_txMaps != null) {
                flags |= EffectDeferredGObject.HasMaps;
            }

            if (_kn5Material.GetPropertyValueAByName("useDetail") > 0) {
                flags |= EffectDeferredGObject.HasDetailsMap;
            }

            if (_txDetailsNormal != null) {
                flags |= EffectDeferredGObject.HasDetailsNormalMap;
            }

            if (_kn5Material.ShaderName == "ksTyres" || _kn5Material.ShaderName == "ksBrakeDisc") {
                flags |= EffectDeferredGObject.UseDiffuseAlphaAsMap;
            }

            if (IsBlending) {
                flags |= EffectDeferredGObject.AlphaBlend;
            }

            if (Equals(_kn5Material.GetPropertyValueAByName("isAdditive"), 1.0f)) {
                flags |= EffectDeferredGObject.IsAdditive;
            }

            var specularExp = _kn5Material.GetPropertyValueAByName("ksSpecularEXP");
            if (Equals(_kn5Material.GetPropertyValueAByName("isAdditive"), 2.0f)) {
                specularExp = 250f;
            }

            _material = new EffectDeferredGObject.Material {
                Ambient = _kn5Material.GetPropertyValueAByName("ksAmbient"),
                Diffuse = _kn5Material.GetPropertyValueAByName("ksDiffuse"),
                Specular = _kn5Material.GetPropertyValueAByName("ksSpecular"),
                SpecularExp = specularExp,
                Emissive = _kn5Material.GetPropertyValueCByName("ksEmissive"),
                FresnelC = _kn5Material.GetPropertyValueAByName("fresnelC"),
                FresnelExp = _kn5Material.GetPropertyValueAByName("fresnelEXP"),
                FresnelMaxLevel = _kn5Material.GetPropertyValueAByName("fresnelMaxLevel"),
                DetailsUvMultipler = _kn5Material.GetPropertyValueAByName("detailUVMultiplier"),
                DetailsNormalBlend = _kn5Material.GetPropertyValueAByName("detailNormalBlend"),
                Flags = flags
            };
        }
Exemplo n.º 3
0
        public void SetEmissive(Vector3 value) {
            SetEmissiveNext(value);

            var material = _material;
            material.Emissive = value;
            _material = material;
        }