//============================================================================================ /** * @brief * *********************************************************************************************/ public PoseData(PoseData a_pose) { PoseId = a_pose.PoseId; AnimId = a_pose.AnimId; TracksId = a_pose.TracksId; PrimaryClipId = a_pose.PrimaryClipId; Time = a_pose.Time; LocalVelocity = a_pose.LocalVelocity; NextPoseId = a_pose.NextPoseId; LastPoseId = a_pose.LastPoseId; Favour = a_pose.Favour; JointsData = new JointData[a_pose.JointsData.Length]; for (int i = 0; i < a_pose.JointsData.Length; ++i) { JointsData[i] = a_pose.JointsData[i]; } Trajectory = new TrajectoryPoint[a_pose.Trajectory.Length]; for (int i = 0; i < Trajectory.Length; ++i) { Trajectory[i] = a_pose.Trajectory[i]; } Tags = a_pose.Tags; FavourTags = a_pose.FavourTags; GenericTags = a_pose.GenericTags; UserTags = a_pose.UserTags; AnimType = a_pose.AnimType; }
public static string AddTag(string pattern, ETags t) { if (!string.IsNullOrEmpty(pattern)) { switch (t) { case ETags.Frame: case ETags.Extension: { pattern += "."; break; } default: { pattern += "-"; break; } } } pattern += tags[(int)t]; return(pattern); }
public EMxMAnimtype AnimType; //Composite, IdleSet or BlendSpace //============================================================================================ /** * @brief * *********************************************************************************************/ public PoseData(int a_poseId, int a_clipId, int a_tracksId, float a_time, Vector3 a_localVelocity, int a_jointCount, int a_trajCount, float a_favour, ETags a_tags = ETags.None, ETags a_favourTags = ETags.None, EGenericTags a_genericTags = EGenericTags.None, EUserTags a_userTags = EUserTags.None, EMxMAnimtype a_animType = EMxMAnimtype.Composite) { PoseId = a_poseId; AnimId = a_clipId; TracksId = a_tracksId; PrimaryClipId = a_clipId; Time = a_time; LocalVelocity = a_localVelocity; Favour = a_favour; JointsData = new JointData[a_jointCount]; Trajectory = new TrajectoryPoint[a_trajCount]; NextPoseId = -1; LastPoseId = -1; Tags = a_tags; FavourTags = a_favourTags; GenericTags = a_genericTags; UserTags = a_userTags; AnimType = a_animType; }
public IdleSetData(ETags a_tags, int a_primaryClipId, int[] a_primaryPoseIds, int[] a_transitionClipsIds, int[] a_transitionPoseIds, int[] a_secondaryClipIds, int[] a_secondaryPoseIds, int a_minLoops, int a_maxLoops) { Tags = a_tags; MinLoops = a_minLoops; MaxLoops = a_maxLoops; PrimaryClipId = a_primaryClipId; PrimaryPoseIds = new int[a_primaryPoseIds.Length]; Array.Copy(a_primaryPoseIds, PrimaryPoseIds, a_primaryPoseIds.Length); TransitionClipIds = new int[a_transitionClipsIds.Length]; Array.Copy(a_transitionClipsIds, TransitionClipIds, a_transitionClipsIds.Length); TransitionPoseIds = new int[a_transitionPoseIds.Length]; Array.Copy(a_transitionPoseIds, TransitionPoseIds, a_transitionPoseIds.Length); SecondaryClipIds = new int[a_secondaryClipIds.Length]; Array.Copy(a_secondaryClipIds, SecondaryClipIds, a_secondaryClipIds.Length); SecondaryPoseIds = new int[a_secondaryPoseIds.Length]; Array.Copy(a_secondaryPoseIds, SecondaryPoseIds, a_secondaryPoseIds.Length); }
public void Execute(int startIndex, int count) { float bestCost = float.MaxValue; int bestPoseId = 0; for (int i = 0; i < count; ++i) { int index = startIndex + i; if (CurrentClipId == PoseClipIds[index]) continue; float curCost = (PoseCosts[index] + TrajCosts[index]) * PoseFavour[index]; ETags activeTags = PoseFavourTags[index] & FavourTags; uint activeTagCount = MxMUtility.CountFlags(activeTags); if (activeTagCount > 0) { curCost *= math.pow(FavourMultiplier, activeTagCount); } if (curCost < bestCost) { bestCost = curCost; bestPoseId = index; } } int batchId = startIndex / BatchSize; ChosenPoseId[batchId] = bestPoseId; ChosenPoseCost[batchId] = bestCost; }
//============================================================================================ /** * @brief * *********************************************************************************************/ private static void OnFlagSelected(object a_context) { var flagIndexPair = a_context as EnumFlagIndexPair; if (flagIndexPair == null) { return; } ETags currentTags = (ETags)flagIndexPair.SpTags.intValue; ETags chosenTag = (ETags)(1 << flagIndexPair.EnumIndex); if ((currentTags & chosenTag) == chosenTag) {//Its already tagged, untag it currentTags = currentTags & (~chosenTag); } else { //It's not already tagged, tag it currentTags = currentTags | chosenTag; } flagIndexPair.SpTags.intValue = (int)currentTags; flagIndexPair.SpTags.serializedObject.ApplyModifiedProperties(); }
public void SetPrimaryAnim(AnimationClip a_clip) { if (a_clip != null) { PrimaryClip = a_clip; Tags = ETags.None; FavourTags = ETags.None; } }
} //The user tags for the current pose. //============================================================================================ /** * @brief Updates the required tags based on any desired required tags the user has set since * the last update. This exists because it is important to only "FetchNativeAnimData" once all * tags change requests have been processed for a frame. Otherwise the NativeAnimData might * not exists * *********************************************************************************************/ private void UpdateRequireTags() { if (m_requiredTags != m_desireRequiredTags) { m_requiredTags = m_desireRequiredTags; FetchNativeAnimData(); CheckIdleSuitability(); } }
private void Start() { m_mxmAnimator = m_playerTransform.GetComponentInChildren <MxMAnimator>(); m_trajectoryGenerator = m_playerTransform.GetComponentInChildren <MxMTrajectoryGenerator>(); m_runTagHandle = m_mxmAnimator.CurrentAnimData.FavourTagFromName(m_runSpeedTagName); m_sprintTagHandle = m_mxmAnimator.CurrentAnimData.FavourTagFromName(m_sprintSpeedTagName); m_mxmAnimator.SetFavourMultiplier(m_favourMultiplier); }
//============================================================================================ /** * @brief Counts the number of active tags in a tag * * @param [ETags] a_tags - the tags to check * *********************************************************************************************/ public static uint CountFlags(ETags a_tags) { uint v = (uint)a_tags; v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); uint c = ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count return c; }
public static string GetString(ELanguage lang, ETags tag) { try { return(dictionary[lang][tag]); } catch { } return(""); }
public void SetPrimaryAnim(AnimationClip a_clip) { if (a_clip != null) { ValidateBaseData(); m_clips.Add(a_clip); m_positions.Add(Vector2.zero); GlobalTags = ETags.None; GlobalFavourTags = ETags.None; } }
public void CopyData(MxMBlendSpace a_copy) { ValidateBaseData(); m_magnitude = a_copy.m_magnitude; m_smoothing = a_copy.m_smoothing; m_scatterSpace = a_copy.m_scatterSpace; m_scatterSpacing = a_copy.m_scatterSpacing; m_scatterPositions = null; UseSpeedMods = a_copy.UseSpeedMods; GlobalTags = a_copy.GlobalTags; GlobalFavourTags = a_copy.GlobalFavourTags; m_clips = new List<AnimationClip>(a_copy.m_clips); m_positions = new List<Vector2>(a_copy.Positions); if(m_targetPrefab == null) m_targetPrefab = a_copy.m_targetPrefab; TagTracks = new List<TagTrack>(a_copy.TagTracks.Count + 1); foreach(TagTrack track in a_copy.TagTracks) { TagTracks.Add(new TagTrack(track)); } FavourTagTracks = new List<TagTrack>(a_copy.FavourTagTracks.Count + 1); foreach(TagTrack track in a_copy.FavourTagTracks) { FavourTagTracks.Add(new TagTrack(track)); } UserBoolTracks = new List<TagTrackBase>(a_copy.UserBoolTracks.Count + 1); foreach(TagTrackBase track in a_copy.UserBoolTracks) { UserBoolTracks.Add(new TagTrackBase(track)); } LeftFootStepTrack = new FootStepTagTrack(a_copy.LeftFootStepTrack); RightFootStepTrack = new FootStepTagTrack(a_copy.RightFootStepTrack); WarpPositionTrack = new TagTrackBase(a_copy.WarpPositionTrack); WarpRotationTrack = new TagTrackBase(a_copy.WarpRotationTrack); EnableRootMotionTrack = new TagTrackBase(a_copy.EnableRootMotionTrack); PoseFavourTrack = new FloatTagTrack(a_copy.PoseFavourTrack); WarpTrajLatTrack = new TagTrackBase(a_copy.WarpTrajLatTrack); WarpTrajLongTrack = new TagTrackBase(a_copy.WarpTrajLongTrack); MotionModifier = new MotionModifyData(a_copy.MotionModifier, this); }
public void CopyData(MxMAnimationIdleSet a_copy) { PrimaryClip = a_copy.PrimaryClip; SecondaryClips = new List<AnimationClip>(a_copy.SecondaryClips); TransitionClips = new List<AnimationClip>(a_copy.TransitionClips); Tags = a_copy.Tags; FavourTags = a_copy.FavourTags; MinLoops = a_copy.MinLoops; MaxLoops = a_copy.MaxLoops; m_targetPreProcessData = a_copy.m_targetPreProcessData; m_targetAnimModule = a_copy.m_targetAnimModule; PoseList = null; }
public IdleSetData(ETags a_tags, int a_primaryClipId, int a_primaryPoseCount, int a_transitionClipCount, int a_secondaryClipCount, int a_minLoops, int a_maxLoops) { Tags = a_tags; MinLoops = a_minLoops; MaxLoops = a_maxLoops; PrimaryClipId = a_primaryClipId; PrimaryPoseIds = new int[a_primaryPoseCount]; TransitionClipIds = new int[a_transitionClipCount]; TransitionPoseIds = new int[a_transitionClipCount]; SecondaryClipIds = new int[a_secondaryClipCount]; SecondaryPoseIds = new int[a_secondaryClipCount]; }
public void SetPrimaryAnim(AnimationClip a_clip) { Undo.RecordObject(this, "Primary Clip Changed"); PrimaryClip = a_clip; if (a_clip != null) { if (a_clip.isLooping) Looping = true; else IgnoreEdges = true; GlobalTags = ETags.None; GlobalFavourTags = ETags.None; } }
public CompositeCategory(CompositeCategory a_copy, ScriptableObject a_parentObj) { CatagoryName = a_copy.CatagoryName; Composites = new List <MxMAnimationClipComposite>(a_copy.Composites.Count + 1); IgnoreEdges_default = a_copy.IgnoreEdges_default; Extrapolate_default = a_copy.Extrapolate_default; FlattenTrajectory_default = a_copy.FlattenTrajectory_default; RuntimeSplicing_default = a_copy.RuntimeSplicing_default; RequireTags_default = a_copy.RequireTags_default; FavourTags_default = a_copy.FavourTags_default; foreach (MxMAnimationClipComposite sourceComposite in a_copy.Composites) { MxMAnimationClipComposite newComposite = ScriptableObject.CreateInstance <MxMAnimationClipComposite>(); newComposite.CopyData(sourceComposite); newComposite.name = sourceComposite.name; newComposite.hideFlags = HideFlags.HideInHierarchy; MxMPreProcessData targetPreProcess = a_parentObj as MxMPreProcessData; AnimationModule targetAnimModule = a_parentObj as AnimationModule; if (targetPreProcess != null) { newComposite.TargetPreProcess = targetPreProcess; newComposite.TargetAnimModule = null; } else if (targetAnimModule != null) { newComposite.TargetPreProcess = null; newComposite.TargetAnimModule = targetAnimModule; } EditorUtility.SetDirty(newComposite); if (a_parentObj != null) { AssetDatabase.AddObjectToAsset(newComposite, a_parentObj); } Composites.Add(newComposite); } }
//============================================================================================ /** * @brief * *********************************************************************************************/ public static void DrawTagFlagFieldWithCustomNames(string[] a_customNames, SerializedProperty a_spTags, float a_width) { //Figure out the name fo the enum ETags enumValue = (ETags)a_spTags.intValue; string enumName = "Mixed"; if (enumValue == 0) { enumName = "None"; } else if ((enumValue & (enumValue - 1)) == 0) { int enumIndex = Array.IndexOf(Enum.GetValues(typeof(ETags)), (ETags)a_spTags.intValue); enumName = a_customNames[enumIndex - 1]; } if (GUILayout.Button(enumName, EditorStyles.popup, GUILayout.Width(a_width))) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("None"), enumValue == ETags.None ? true : false, OnNoneSelected, a_spTags); menu.AddItem(new GUIContent("Everything"), false, OnEverythingSelected, a_spTags); int currentTags = a_spTags.intValue; for (int i = 0; i < a_customNames.Length; ++i) { bool isSelected = ((int)currentTags & (1 << i)) == (1 << i); EnumFlagIndexPair enumFlagIndexPair = new EnumFlagIndexPair(i, a_spTags, isSelected); menu.AddItem(new GUIContent(a_customNames[i]), isSelected, OnFlagSelected, enumFlagIndexPair); } menu.ShowAsContext(); } }
public static ETags SetTag(ETags _source, ETags _tag) { return(_source | _tag); }
public static ETags ToggleTag(ETags _source, ETags _tag) { return(_source ^ _tag); }
public static string GetString(ETags tag) { return(GetString(Current, tag)); }
internal void OnLoad() { Mouse = window.Mouse; Keyboard = window.Keyboard; #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api(this); #endif Graphics.MakeGraphicsInfo(); Options.Load(); Entities = new EntityList(this); AcceptedUrls.Load(); DeniedUrls.Load(); ETags.Load(); InputHandler = new InputHandler(this); defaultIb = Graphics.MakeDefaultIb(); ParticleManager = AddComponent(new ParticleManager()); TabList = AddComponent(new TabList()); LoadOptions(); LoadGuiOptions(); Chat = AddComponent(new Chat()); WorldEvents.OnNewMap += OnNewMapCore; WorldEvents.OnNewMapLoaded += OnNewMapLoadedCore; BlockInfo = new BlockInfo(); BlockInfo.Init(); ModelCache = new ModelCache(this); ModelCache.InitCache(); AsyncDownloader = AddComponent(new AsyncDownloader()); Drawer2D = new GdiPlusDrawer2D(Graphics); Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.ArialChatFont, false); Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackTextShadows, false); TerrainAtlas1D = new TerrainAtlas1D(Graphics); TerrainAtlas = new TerrainAtlas2D(Graphics, Drawer2D); Animations = AddComponent(new Animations()); Inventory = AddComponent(new Inventory()); BlockInfo.SetDefaultBlockPermissions(Inventory.CanPlace, Inventory.CanDelete); World = new World(this); LocalPlayer = AddComponent(new LocalPlayer(this)); Entities[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer(this); MapBordersRenderer = AddComponent(new MapBordersRenderer()); EnvRenderer = AddComponent(new StandardEnvRenderer()); if (IPAddress == null) { Network = new Singleplayer.SinglePlayerServer(this); } else { Network = new Network.NetworkProcessor(this); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera(this); thirdPersonCam = new ThirdPersonCamera(this); forwardThirdPersonCam = new ForwardThirdPersonCamera(this); Camera = firstPersonCam; UpdateProjection(); CommandManager = AddComponent(new CommandManager()); SelectionManager = AddComponent(new SelectionManager()); WeatherRenderer = AddComponent(new WeatherRenderer()); BlockHandRenderer = AddComponent(new BlockHandRenderer()); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); fpsScreen = AddComponent(new FpsScreen(this)); hudScreen = AddComponent(new HudScreen(this)); Culling = new FrustumCulling(); Picking = AddComponent(new PickedPosRenderer()); AudioPlayer = AddComponent(new AudioPlayer()); AxisLinesRenderer = AddComponent(new AxisLinesRenderer()); SkyboxRenderer = AddComponent(new SkyboxRenderer()); foreach (IGameComponent comp in Components) { comp.Init(this); } ExtractInitialTexturePack(); foreach (IGameComponent comp in Components) { comp.Ready(this); } LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; if (Graphics.WarnIfNecessary(Chat)) { MapBordersRenderer.UseLegacyMode(true); ((StandardEnvRenderer)EnvRenderer).UseLegacyMode(true); } SetNewScreen(new LoadingMapScreen(this, connectString, "Waiting for handshake")); Network.Connect(IPAddress, Port); }
internal void OnLoad() { Mouse = window.Mouse; Keyboard = window.Keyboard; #if ANDROID Graphics = new OpenGLESApi(); #elif !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api(this); #endif Graphics.MakeApiInfo(); ErrorHandler.AdditionalInfo = Graphics.ApiInfo; #if ANDROID Drawer2D = new CanvasDrawer2D(Graphics); #else Drawer2D = new GdiPlusDrawer2D(Graphics); #endif Entities = new EntityList(this); AcceptedUrls.Load(); DeniedUrls.Load(); ETags.Load(); LastModified.Load(); if (Options.GetBool(OptionsKey.SurvivalMode, false)) { Mode = new SurvivalGameMode(); } else { Mode = new CreativeGameMode(); } Components.Add(Mode); Input = new InputHandler(this); defaultIb = Graphics.MakeDefaultIb(); ParticleManager = new ParticleManager(); Components.Add(ParticleManager); TabList = new TabList(); Components.Add(TabList); LoadOptions(); LoadGuiOptions(); Chat = new Chat(); Components.Add(Chat); WorldEvents.OnNewMap += OnNewMapCore; WorldEvents.OnNewMapLoaded += OnNewMapLoadedCore; Events.TextureChanged += TextureChangedCore; BlockInfo.Allocate(256); BlockInfo.Init(); ModelCache = new ModelCache(this); ModelCache.InitCache(); Downloader = new AsyncDownloader(Drawer2D); Components.Add(Downloader); Lighting = new BasicLighting(); Components.Add(Lighting); Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.UseChatFont, false); Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackText, false); Graphics.Mipmaps = Options.GetBool(OptionsKey.Mipmaps, false); TerrainAtlas1D.game = this; TerrainAtlas2D.game = this; Animations = new Animations(); Components.Add(Animations); Inventory = new Inventory(); Components.Add(Inventory); SurvInv = new SurvivalInventory(); Components.Add(SurvInv); Inventory.Map = new BlockID[BlockInfo.Count]; RecipeList = Recipes.MakeRecipeList(); BlockInfo.SetDefaultPerms(); World = new World(this); LocalPlayer = new LocalPlayer(this); Components.Add(LocalPlayer); Entities.List[EntityList.SelfID] = LocalPlayer; Width = window.Width; Height = window.Height; MapRenderer = new MapRenderer(this); string renType = Options.Get(OptionsKey.RenderType) ?? "normal"; if (!SetRenderType(renType)) { SetRenderType("normal"); } if (IPAddress == null) { Server = new Singleplayer.SinglePlayerServer(this); } else { Server = new Network.NetworkProcessor(this); } Graphics.LostContextFunction = Server.Tick; Cameras.Add(new FirstPersonCamera(this)); Cameras.Add(new ThirdPersonCamera(this, false)); Cameras.Add(new ThirdPersonCamera(this, true)); Camera = Cameras[0]; UpdateProjection(); Gui = new GuiInterface(this); Components.Add(Gui); CommandList = new CommandList(); Components.Add(CommandList); SelectionManager = new SelectionManager(); Components.Add(SelectionManager); WeatherRenderer = new WeatherRenderer(); Components.Add(WeatherRenderer); HeldBlockRenderer = new HeldBlockRenderer(); Components.Add(HeldBlockRenderer); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); Culling = new FrustumCulling(); Picking = new PickedPosRenderer(); Components.Add(Picking); AudioPlayer = new AudioPlayer(); Components.Add(AudioPlayer); AxisLinesRenderer = new AxisLinesRenderer(); Components.Add(AxisLinesRenderer); SkyboxRenderer = new SkyboxRenderer(); Components.Add(SkyboxRenderer); CelestialRenderer = new CelestialRenderer(); Components.Add(CelestialRenderer); PluginLoader.game = this; List <string> nonLoaded = PluginLoader.LoadAll(); for (int i = 0; i < Components.Count; i++) { Components[i].Init(this); } ExtractInitialTexturePack(); for (int i = 0; i < Components.Count; i++) { Components[i].Ready(this); } InitScheduledTasks(); if (nonLoaded != null) { for (int i = 0; i < nonLoaded.Count; i++) { Overlay warning = new PluginOverlay(this, nonLoaded[i]); Gui.ShowOverlay(warning, false); } } window.LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; if (Graphics.WarnIfNecessary(Chat)) { //MapBordersRenderer.UseLegacyMode(true); EnvRenderer.UseLegacyMode(true); } Gui.SetNewScreen(new LoadingMapScreen(this, connectString, "")); Server.Connect(IPAddress, Port); }
//============================================================================================ /** * @brief Copy constructor for the TagTrack class * * @param [TagTrack] _copy - the track to copy from * *********************************************************************************************/ public TagTrack(TagTrack _copy) { m_tagId = _copy.m_tagId; m_clipLength = _copy.m_clipLength; m_tags = new List <Vector2>(_copy.m_tags); }
//============================================================================================ /** * @brief Constructor for the TagTrack class * * @param [int] _tagId - the id of the tag (relates to the tags in the animator * @param [float] _clipLength - the length of the animation clip the track belongs to * *********************************************************************************************/ public TagTrack(ETags _tagId, float _clipLength) { m_tagId = _tagId; m_clipLength = _clipLength; m_tags = new List <Vector2>(); }
public static bool HasTags(ETags _source, ETags _tag) { return((_source & _tag) == _tag); }
public void CopyData(MxMAnimationClipComposite a_copy) { PrimaryClip = a_copy.PrimaryClip; BeforeClips = new List<AnimationClip>(a_copy.BeforeClips); AfterClips = new List<AnimationClip>(a_copy.AfterClips); Looping= a_copy.Looping; IgnoreEdges = a_copy.IgnoreEdges; ExtrapolateTrajectory = a_copy.ExtrapolateTrajectory; FlattenTrajectory = a_copy.FlattenTrajectory; RuntimeSplicing = a_copy.RuntimeSplicing; UseSpeedMods = a_copy.UseSpeedMods; GlobalTags = a_copy.GlobalTags; GlobalFavourTags = a_copy.GlobalFavourTags; TagTracks = new List<TagTrack>(a_copy.TagTracks.Count + 1); foreach(TagTrack track in a_copy.TagTracks) { TagTracks.Add(new TagTrack(track)); } for (int i = 0; i < a_copy.TagTracks.Count; ++i) { TagTracks.Add(new TagTrack(a_copy.TagTracks[i])); } FavourTagTracks = new List<TagTrack>(a_copy.FavourTagTracks.Count + 1); foreach(TagTrack track in a_copy.FavourTagTracks) { FavourTagTracks.Add(new TagTrack(track)); } UserBoolTracks = new List<TagTrackBase>(a_copy.UserBoolTracks.Count + 1); foreach(TagTrackBase track in a_copy.UserBoolTracks) { UserBoolTracks.Add(new TagTrackBase(track)); } Events = new List<EventMarker>(a_copy.Events.Count + 1); foreach(EventMarker marker in a_copy.Events) { Events.Add(new EventMarker(marker)); } m_targetPreProcessData = a_copy.m_targetPreProcessData; m_targetAnimModule = a_copy.m_targetAnimModule; m_targetPrefab = a_copy.m_targetPrefab; PoseList = null; LeftFootStepTrack = new FootStepTagTrack(a_copy.LeftFootStepTrack); RightFootStepTrack = new FootStepTagTrack(a_copy.RightFootStepTrack); WarpPositionTrack = new TagTrackBase(a_copy.WarpPositionTrack); WarpRotationTrack = new TagTrackBase(a_copy.WarpRotationTrack); EnableRootMotionTrack = new TagTrackBase(a_copy.EnableRootMotionTrack); PoseFavourTrack = new FloatTagTrack(a_copy.PoseFavourTrack); WarpTrajLatTrack = new TagTrackBase(a_copy.WarpTrajLatTrack); WarpTrajLongTrack = new TagTrackBase(a_copy.WarpTrajLongTrack); MotionModifier = new MotionModifyData(a_copy.MotionModifier, this); }
internal void OnLoad() { Mouse = window.Mouse; Keyboard = window.Keyboard; #if ANDROID Graphics = new OpenGLESApi(); #elif !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api(this); #endif Graphics.MakeApiInfo(); ErrorHandler.AdditionalInfo = Graphics.ApiInfo; Options.Load(); Entities = new EntityList(this); AcceptedUrls.Load(); DeniedUrls.Load(); ETags.Load(); LastModified.Load(); InputHandler = new InputHandler(this); defaultIb = Graphics.MakeDefaultIb(); ParticleManager = AddComponent(new ParticleManager()); TabList = AddComponent(new TabList()); LoadOptions(); LoadGuiOptions(); Chat = AddComponent(new Chat()); WorldEvents.OnNewMap += OnNewMapCore; WorldEvents.OnNewMapLoaded += OnNewMapLoadedCore; Events.TextureChanged += TextureChangedCore; BlockInfo = new BlockInfo(); BlockInfo.Init(); ModelCache = new ModelCache(this); ModelCache.InitCache(); AsyncDownloader = AddComponent(new AsyncDownloader()); #if ANDROID Drawer2D = new CanvasDrawer2D(Graphics); #else Drawer2D = new GdiPlusDrawer2D(Graphics); #endif Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.ArialChatFont, false); Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackTextShadows, false); TerrainAtlas1D = new TerrainAtlas1D(Graphics); TerrainAtlas = new TerrainAtlas2D(Graphics, Drawer2D); Animations = AddComponent(new Animations()); Inventory = AddComponent(new Inventory()); BlockInfo.SetDefaultBlockPerms(Inventory.CanPlace, Inventory.CanDelete); World = new World(this); LocalPlayer = AddComponent(new LocalPlayer(this)); Entities[255] = LocalPlayer; Width = window.Width; Height = window.Height; MapRenderer = new MapRenderer(this); string renType = Options.Get(OptionsKey.RenderType) ?? "normal"; if (!SetRenderType(renType)) { SetRenderType("normal"); } if (IPAddress == null) { Server = new Singleplayer.SinglePlayerServer(this); } else { Server = new Network.NetworkProcessor(this); } Graphics.LostContextFunction = Server.Tick; firstPersonCam = new FirstPersonCamera(this); thirdPersonCam = new ThirdPersonCamera(this, false); forwardThirdPersonCam = new ThirdPersonCamera(this, true); Camera = firstPersonCam; UpdateProjection(); Gui = AddComponent(new GuiInterface(this)); CommandList = AddComponent(new CommandList()); SelectionManager = AddComponent(new SelectionManager()); WeatherRenderer = AddComponent(new WeatherRenderer()); HeldBlockRenderer = AddComponent(new HeldBlockRenderer()); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); Culling = new FrustumCulling(); Picking = AddComponent(new PickedPosRenderer()); AudioPlayer = AddComponent(new AudioPlayer()); AxisLinesRenderer = AddComponent(new AxisLinesRenderer()); SkyboxRenderer = AddComponent(new SkyboxRenderer()); for (int i = 0; i < Components.Count; i++) { Components[i].Init(this); } ExtractInitialTexturePack(); for (int i = 0; i < Components.Count; i++) { Components[i].Ready(this); } InitScheduledTasks(); window.LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; if (Graphics.WarnIfNecessary(Chat)) { MapBordersRenderer.UseLegacyMode(true); EnvRenderer.UseLegacyMode(true); } Gui.SetNewScreen(new LoadingMapScreen(this, connectString, "Waiting for handshake")); Server.Connect(IPAddress, Port); }
public static ETags UnsetTag(ETags _source, ETags _tag) { return(_source & (~_tag)); }