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 FillUVSwapCache(Dictionary<string, object> json_obj, string key, int start_time, int end_time, ref MeshUVWarpCacheManager cache_manager) { Dictionary<string, object> base_obj = (Dictionary<string, object>)json_obj[key]; cache_manager.init(start_time, end_time); foreach (KeyValuePair<string, object> cur_node in base_obj) { int cur_time = Convert.ToInt32(cur_node.Key); List<MeshUVWarpCache> cache_list = new List<MeshUVWarpCache>(); Dictionary<string, object> node_dict = (Dictionary<string, object>)cur_node.Value; foreach (KeyValuePair<string, object> uv_node in node_dict) { string cur_name = uv_node.Key; Dictionary<string, object> uv_dict = (Dictionary<string, object>)uv_node.Value; MeshUVWarpCache cache_data = new MeshUVWarpCache(cur_name); bool use_uv = Utils.ReadBoolJSON(uv_dict, "enabled"); //GetJSONNodeFromKey(*uv_node, "enabled")->value.toBool(); cache_data.setEnabled(use_uv); if(use_uv) { XnaGeometry.Vector2 local_offset = Utils.ReadVector2JSON(uv_dict, "local_offset"); //ReadJSONVec2(*uv_node, "local_offset"); XnaGeometry.Vector2 global_offset = Utils.ReadVector2JSON(uv_dict, "global_offset"); //ReadJSONVec2(*uv_node, "global_offset"); XnaGeometry.Vector2 scale = Utils.ReadVector2JSON(uv_dict, "scale"); //ReadJSONVec2(*uv_node, "scale"); cache_data.setUvWarpLocalOffset(local_offset); cache_data.setUvWarpGlobalOffset(global_offset); cache_data.setUvWarpScale(scale); } cache_list.Add(cache_data); } int set_index = cache_manager.getIndexByTime(cur_time); cache_manager.uv_cache_table[set_index] = cache_list; } cache_manager.makeAllReady(); }