public MaterialEngineParameter(MaterialEngineParameter engineParam, String name, IEffectParameter replacement)
 {
     _effectParameter = replacement;
     _isSemantic      = engineParam.IsSemantic;
     _engineValue     = engineParam.EngineValue;
     _name            = name;
 }
Beispiel #2
0
        public void SetEngineParameter(String paramName, bool isSemantic, EngineValue engineValue)
        {
            if (IsValid)
            {
                IEffectParameter param = null;

                if (isSemantic)
                {
                    param = _effect.Parameters.GetParameterBySemantic(paramName);
                }
                else
                {
                    param = _effect.Parameters[paramName];
                }

                //Doesn't exist, don't create an entry
                if (param == null)
                {
                    return;
                }
                MaterialEngineParameter engineParam = new MaterialEngineParameter(param, paramName, isSemantic, engineValue);
                _cachedEngineParameters[paramName] = engineParam;
            }
            else
            {
                throw new ArgumentNullException("Material does not have a valid effect loaded, cannot set engine parameter. Call LoadEffect() first.");
            }
        }
 public MaterialEngineParameter(MaterialEngineParameter engineParam)
 {
     _effectParameter = engineParam.EffectParameter;
     _isSemantic      = engineParam.IsSemantic;
     _engineValue     = engineParam.EngineValue;
     _name            = engineParam.Name;
 }
Beispiel #4
0
 private void CloneEngineParameters(Material clone)
 {
     foreach (KeyValuePair <String, MaterialEngineParameter> kv in _cachedEngineParameters)
     {
         MaterialEngineParameter param = kv.Value;
         clone.SetEngineParameter(param.Name, param.IsSemantic, param.EngineValue);
     }
 }