public T Resolve <T>(IObjectWithID obj) where T : StyleObject { T res = (_styles.AllStyles.Find(styleObject => styleObject.GetType() == typeof(T)) as T).Clone() as T; SlimDX.Vector4 color = EncodeColor(obj).ToVector4(); Material mat = new Material(color, color, color); res.SetProperties(mat); return(res); }
public SlimDX.Color4 EncodeColor(IObjectWithID obj) { int major = 0; if (!_typeToMajorId.TryGetValue(obj.GetType(), out major)) { return(new SlimDX.Color4(0x00000000)); } int minor = (int)obj.ID; if (major >= (1 << _bitsPerMajorID) || minor >= (1 << _bitsPerMinorID)) { throw new ApplicationException("Internal error - too much selectable objects"); } return(new SlimDX.Color4(0x00000000 | (major << _bitsPerMinorID) | minor)); }
public T Resolve <T>(IObjectWithID obj) where T : StyleObject { return((obj.Equals(SelectedObject) ? _selected : _unSelected) .AllStyles.Find(styleObject => styleObject.GetType() == typeof(T)) as T); }