Added a metric ruler to the demo scenes.
@@ -76,8 +76,29 @@ class Program
UI.SameLine();
}
UI.WindowEnd();
+
+ RulerWindow();
}
static void CommonShutdown()
{
}
+
+ static Pose demoRuler = new Pose(0, 0, .5f, Quat.Identity);
+ static void RulerWindow()
+ {
+ UI.AffordanceBegin("Ruler", ref demoRuler, Vec3.Zero, new Vec3(30,4,1)*Units.cm2m, true);
+ Color32 color = Color.HSV(.6f, 0.5f, 1);
+ Hierarchy.Push(demoRuler.ToMatrix());
+ Text.Add("Centimeters", Matrix.TRS(new Vec3(-0.5f, -3.5f, -1.1f) * Units.cm2m, Quat.Identity, .3f), TextAlign.XLeft | TextAlign.YBottom);
+ for (int d = 0; d <= 60; d+=1)
+ {
+ float x = d/2.0f;
+ float size = d%2==0?1f:0.15f;
+ Lines.Add(new Vec3(-x,0,-1.1f)* Units.cm2m, new Vec3(-x,-size, -1.1f) *Units.cm2m, color, Units.mm2m*0.5f);
+ if (d%2==0 && d/2 != 30)
+ Text.Add((d/2).ToString(), Matrix.TRS(new Vec3(-x-0.1f, -size, -1.1f) * Units.cm2m, Quat.Identity, .2f), TextAlign.XLeft|TextAlign.YBottom);
+ }
+ Hierarchy.Pop();
+ UI.AffordanceEnd();
+ }
}
\ No newline at end of file
