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 FillBoneCache(Dictionary<string, object> json_obj, string key, int start_time, int end_time, ref MeshBoneCacheManager 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<MeshBoneCache> cache_list = new List<MeshBoneCache>(); Dictionary<string, object> node_dict = (Dictionary<string, object>)cur_node.Value; foreach (KeyValuePair<string, object> bone_node in node_dict) { string cur_name = bone_node.Key; Dictionary<string, object> bone_dict = (Dictionary<string, object>)bone_node.Value; XnaGeometry.Vector4 cur_start_pt = Utils.ReadVector4JSON(bone_dict, "start_pt"); //ReadJSONVec4_2(*bone_node, "start_pt"); XnaGeometry.Vector4 cur_end_pt = Utils.ReadVector4JSON(bone_dict, "end_pt"); //ReadJSONVec4_2(*bone_node, "end_pt"); MeshBoneCache cache_data = new MeshBoneCache(cur_name); cache_data.setWorldStartPt(cur_start_pt); cache_data.setWorldEndPt(cur_end_pt); cache_list.Add(cache_data); } int set_index = cache_manager.getIndexByTime(cur_time); cache_manager.bone_cache_table[set_index] = cache_list; } cache_manager.makeAllReady(); }