Here are the examples of the csharp api Microsoft.MixedReality.Toolkit.Diagnostics.MixedRealityToolkitVisualProfiler.CreateText(string, UnityEngine.Vector3, UnityEngine.Transform, UnityEngine.TextAnchor, UnityEngine.Material, UnityEngine.Color, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
View Source File : MixedRealityToolkitVisualProfiler.cs
License : MIT License
Project Creator : vbandi
License : MIT License
Project Creator : vbandi
private void BuildWindow()
{
// Initialize property block state.
colorID = Shader.PropertyToID("_Color");
parentMatrixID = Shader.PropertyToID("_ParentLocalToWorldMatrix");
// Build the window root.
{
window = new GameObject("VisualProfiler").transform;
window.parent = WindowParent;
window.localScale = defaultWindowScale;
windowHorizontalRotation = Quaternion.AngleAxis(defaultWindowRotation.y, Vector3.right);
windowHorizontalRotationInverse = Quaternion.Inverse(windowHorizontalRotation);
windowVerticalRotation = Quaternion.AngleAxis(defaultWindowRotation.x, Vector3.up);
windowVerticalRotationInverse = Quaternion.Inverse(windowVerticalRotation);
}
// Build the window background.
{
background = CreateQuad("Background", window).transform;
InitializeRenderer(background.gameObject, backgroundMaterial, colorID, baseColor);
CalculateBackgroundSize();
}
// Add frame rate text and frame indicators.
{
cpuFrameRateText = CreateText("CPUFrameRateText", new Vector3(-0.495f, 0.5f, 0.0f), window, TextAnchor.UpperLeft, textMaterial, Color.white, string.Empty);
gpuFrameRateText = CreateText("GPUFrameRateText", new Vector3(0.495f, 0.5f, 0.0f), window, TextAnchor.UpperRight, textMaterial, Color.white, string.Empty);
gpuFrameRateText.gameObject.SetActive(false);
frameInfoMatrices = new Matrix4x4[frameRange];
frameInfoColors = new Vector4[frameRange];
Vector3 scale = new Vector3(1.0f / frameRange, 0.2f, 1.0f);
Vector3 position = new Vector3(0.5f - (scale.x * 0.5f), 0.15f, 0.0f);
for (int i = 0; i < frameRange; ++i)
{
frameInfoMatrices[i] = Matrix4x4.TRS(position, Quaternion.idenreplacedy, new Vector3(scale.x * 0.8f, scale.y, scale.z));
position.x -= scale.x;
frameInfoColors[i] = CalculateFrameColor((int)AppTargetFrameRate);
}
frameInfoPropertyBlock = new MaterialPropertyBlock();
frameInfoPropertyBlock.SetVectorArray(colorID, frameInfoColors);
}
// Add memory usage text and bars.
{
memoryStats = new GameObject("MemoryStats").transform;
memoryStats.parent = window;
memoryStats.localScale = Vector3.one;
usedMemoryText = CreateText("UsedMemoryText", new Vector3(-0.495f, 0.0f, 0.0f), memoryStats, TextAnchor.UpperLeft, textMaterial, memoryUsedColor, usedMemoryString);
peakMemoryText = CreateText("PeakMemoryText", new Vector3(0.0f, 0.0f, 0.0f), memoryStats, TextAnchor.UpperCenter, textMaterial, memoryPeakColor, peakMemoryString);
limitMemoryText = CreateText("LimitMemoryText", new Vector3(0.495f, 0.0f, 0.0f), memoryStats, TextAnchor.UpperRight, textMaterial, Color.white, limitMemoryString);
voiceCommandText = CreateText("VoiceCommandText", new Vector3(-0.525f, -0.7f, 0.0f), memoryStats, TextAnchor.UpperLeft, textMaterial, Color.white, voiceCommandString);
mrtkText = CreateText("MRTKText", new Vector3(0.52f, -0.7f, 0.0f), memoryStats, TextAnchor.UpperRight, textMaterial, Color.white, visualProfilerreplacedleString);
voiceCommandText.fontSize = 32;
mrtkText.fontSize = 32;
GameObject limitBar = CreateQuad("LimitBar", memoryStats);
InitializeRenderer(limitBar, defaultMaterial, colorID, memoryLimitColor);
limitBar.transform.localScale = new Vector3(0.99f, 0.2f, 1.0f);
limitBar.transform.localPosition = new Vector3(0.0f, -0.37f, 0.0f);
{
usedAnchor = CreateAnchor("UsedAnchor", limitBar.transform);
GameObject bar = CreateQuad("UsedBar", usedAnchor);
Material material = new Material(foregroundMaterial);
material.renderQueue = material.renderQueue + 1;
InitializeRenderer(bar, material, colorID, memoryUsedColor);
bar.transform.localScale = Vector3.one;
bar.transform.localPosition = new Vector3(0.5f, 0.0f, 0.0f);
}
{
peakAnchor = CreateAnchor("PeakAnchor", limitBar.transform);
GameObject bar = CreateQuad("PeakBar", peakAnchor);
InitializeRenderer(bar, foregroundMaterial, colorID, memoryPeakColor);
bar.transform.localScale = Vector3.one;
bar.transform.localPosition = new Vector3(0.5f, 0.0f, 0.0f);
}
}
window.gameObject.SetActive(ShouldShowProfiler);
memoryStats.gameObject.SetActive(memoryStatsVisible);
}