public CreatureAnimation(ref Dictionary<string, object> load_data, string name_in) { name = name_in; bones_cache = new MeshBoneCacheManager (); displacement_cache = new MeshDisplacementCacheManager (); uv_warp_cache = new MeshUVWarpCacheManager (); opacity_cache = new MeshOpacityCacheManager (); cache_pts = new List<List<float> > (); LoadFromData(name_in, ref load_data); }
public static void FillOpacityCache(Dictionary<string, object> json_obj, string key, int start_time, int end_time, ref MeshOpacityCacheManager cache_manager) { cache_manager.init(start_time, end_time); if(json_obj.ContainsKey(key) == false) { return; } Dictionary<string, object> base_obj = (Dictionary<string, object>)json_obj[key]; foreach (KeyValuePair<string, object> cur_node in base_obj) { int cur_time = Convert.ToInt32(cur_node.Key); List<MeshOpacityCache> cache_list = new List<MeshOpacityCache>(); Dictionary<string, object> node_dict = (Dictionary<string, object>)cur_node.Value; foreach (KeyValuePair<string, object> opacity_node in node_dict) { string cur_name = opacity_node.Key; Dictionary<string, object> opacity_dict = (Dictionary<string, object>)opacity_node.Value; MeshOpacityCache cache_data = new MeshOpacityCache(cur_name); double cur_opacity = Convert.ToDouble (opacity_dict["opacity"]); cache_data.setOpacity((float)cur_opacity); cache_list.Add(cache_data); } int set_index = cache_manager.getIndexByTime(cur_time); cache_manager.opacity_cache_table[set_index] = cache_list; } cache_manager.makeAllReady(); }