private bool DrawAssetToggle(StoredAsset asset, DrawFlag draw) { StringBuilder sb = new StringBuilder(); if ((draw & DrawFlag.publisher) == DrawFlag.publisher) { sb.AppendFormat("{0} | ", asset.publisher); } if ((draw & DrawFlag.category) == DrawFlag.category) { sb.AppendFormat("{0} / ", asset.category); } if ((draw & DrawFlag.name) == DrawFlag.name) { sb.AppendFormat("{0} ", asset.name); } if ((draw & DrawFlag.version) == DrawFlag.version) { sb.AppendFormat("[{0}] ", asset.version); } if ((draw & DrawFlag.size) == DrawFlag.size) { sb.AppendFormat("({0} Mb)", asset.size); } return(GUILayout.Toggle(asset.selected, sb.ToString())); }
void DrawFlagAdded <T>() where T : struct { if (drawFlags.Length < flagCount) { Array.Resize(ref drawFlags, drawFlags.Length * 2); } drawFlags[flagCount - 1] = new DrawFlag(CreateDrawFlagArray <T>()); }
private void InitDrawFlagCollection() { lock (flagSync) { drawStateInstances.Add(new WeakReference(this)); for (int i = 0; i < flagCount; i++) { singleEntryTypeList[0] = flagInstancesTypes[i]; MethodInfo createMethod = GetType().GetMethod("CreateDrawFlagArray", BindingFlags.Static | BindingFlags.NonPublic).MakeGenericMethod(singleEntryTypeList); drawFlags[i] = new DrawFlag((Array)createMethod.Invoke(null, emptyObjectList)); } } }
private void LateUpdate() { DrawFlag flags = 0; if (DrawShape) { flags |= DrawFlag.DrawShape; } if (DrawJoint) { flags |= DrawFlag.DrawJoint; } if (DrawAABB) { flags |= DrawFlag.DrawAABB; } if (DrawPair) { flags |= DrawFlag.DrawPair; } if (DrawCenterOfMass) { flags |= DrawFlag.DrawCenterOfMass; } if (DrawContactPoint) { flags |= DrawFlag.DrawContactPoint; } WorldDrawer.Flags = flags; World.DrawDebugData(); }
private void LateUpdate() { OnLateUpdate(); DrawFlag flags = 0; if (TestSettings.Shape) { flags |= DrawFlag.DrawShape; } if (TestSettings.Joint) { flags |= DrawFlag.DrawJoint; } if (TestSettings.AABB) { flags |= DrawFlag.DrawAABB; } if (TestSettings.Pair) { flags |= DrawFlag.DrawPair; } if (TestSettings.CenterOfMass) { flags |= DrawFlag.DrawCenterOfMass; } if (TestSettings.ContactPoint) { flags |= DrawFlag.DrawContactPoint; } TestSettings.WorldDrawer.Flags = flags; DrawWorld(); // Statistics if (TestSettings.Statistics) { DrawString( $"bodies/contacts/joints = {World.BodyCount}/{World.ContactCount}/{World.JointCount}"); DrawString( $"proxies:{World.ProxyCount}/ height:{World.TreeHeight}/ balance: {World.TreeBalance} /quality: {World.TreeQuality}"); } // Profile if (TestSettings.Profile) { var p = World.Profile; // Track maximum profile times _maxProfile.Step = Math.Max(_maxProfile.Step, p.Step); _maxProfile.Collide = Math.Max(_maxProfile.Collide, p.Collide); _maxProfile.Solve = Math.Max(_maxProfile.Solve, p.Solve); _maxProfile.SolveInit = Math.Max(_maxProfile.SolveInit, p.SolveInit); _maxProfile.SolveVelocity = Math.Max(_maxProfile.SolveVelocity, p.SolveVelocity); _maxProfile.SolvePosition = Math.Max(_maxProfile.SolvePosition, p.SolvePosition); _maxProfile.SolveTOI = Math.Max(_maxProfile.SolveTOI, p.SolveTOI); _maxProfile.Broadphase = Math.Max(_maxProfile.Broadphase, p.Broadphase); _totalProfile.Step += p.Step; _totalProfile.Collide += p.Collide; _totalProfile.Solve += p.Solve; _totalProfile.SolveInit += p.SolveInit; _totalProfile.SolveVelocity += p.SolveVelocity; _totalProfile.SolvePosition += p.SolvePosition; _totalProfile.SolveTOI += p.SolveTOI; _totalProfile.Broadphase += p.Broadphase; var aveProfile = new Profile(); if (FrameManager.FrameCount > 0) { var scale = 1.0f / FrameManager.FrameCount; aveProfile.Step = scale * _totalProfile.Step; aveProfile.Collide = scale * _totalProfile.Collide; aveProfile.Solve = scale * _totalProfile.Solve; aveProfile.SolveInit = scale * _totalProfile.SolveInit; aveProfile.SolveVelocity = scale * _totalProfile.SolveVelocity; aveProfile.SolvePosition = scale * _totalProfile.SolvePosition; aveProfile.SolveTOI = scale * _totalProfile.SolveTOI; aveProfile.Broadphase = scale * _totalProfile.Broadphase; } DrawString($"step [ave] (max) = {p.Step} [{aveProfile.Step}] ({_maxProfile.Step})"); DrawString( $"collide [ave] (max) = {p.Collide} [{aveProfile.Collide}] ({_maxProfile.Collide})"); DrawString($"solve [ave] (max) = {p.Solve} [{aveProfile.Solve}] ({_maxProfile.Solve})"); DrawString( $"solve init [ave] (max) = {p.SolveInit} [{aveProfile.SolveInit}] ({_maxProfile.SolveInit})"); DrawString( $"solve velocity [ave] (max) = {p.SolveVelocity} [{aveProfile.SolveVelocity}] ({_maxProfile.SolveVelocity})"); DrawString( $"solve position [ave] (max) = {p.SolvePosition} [{aveProfile.SolvePosition}] ({_maxProfile.SolvePosition})"); DrawString( $"solveTOI [ave] (max) = {p.SolveTOI} [{aveProfile.SolveTOI}] ({_maxProfile.SolveTOI})"); DrawString( $"broad-phase [ave] (max) = {p.Broadphase} [{aveProfile.Broadphase}] ({_maxProfile.Broadphase})"); } if (_stringBuilder.Length > 0) { _text = _stringBuilder.ToString(); _stringBuilder.Clear(); } }
private bool DrawAssetToggle(StoredAsset asset, DrawFlag draw) { StringBuilder sb = new StringBuilder(); if ((draw & DrawFlag.publisher) == DrawFlag.publisher) sb.AppendFormat("{0} | ", asset.publisher); if ((draw & DrawFlag.category) == DrawFlag.category) sb.AppendFormat("{0} / ", asset.category); if ((draw & DrawFlag.name) == DrawFlag.name) sb.AppendFormat("{0} ", asset.name); if ((draw & DrawFlag.version) == DrawFlag.version) sb.AppendFormat("[{0}] ", asset.version); if ((draw & DrawFlag.size) == DrawFlag.size) sb.AppendFormat("({0} Mb)", asset.size); return GUILayout.Toggle(asset.selected, sb.ToString()); }