mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
GLCanvas_demo: Included more options
git-svn-id: svn://ultimatepp.org/upp/trunk@14679 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
38a0671bcb
commit
d9768e2b64
2 changed files with 15 additions and 3 deletions
|
|
@ -1,7 +1,9 @@
|
|||
LAYOUT(GLCanvas_demoLayout, 480, 372)
|
||||
ITEM(GLCanvas, canvas, SetFrame(ThinInsetFrame()).HSizePosZ(4, 4).VSizePosZ(24, 4))
|
||||
ITEM(Label, dv___1, SetLabel(t_("File (.stl):")).LeftPosZ(8, 52).TopPosZ(4, 19))
|
||||
ITEM(EditString, filename, HSizePosZ(60, 52).TopPosZ(4, 19))
|
||||
ITEM(Button, butOpen, SetLabel(t_("Open")).RightPosZ(4, 44).TopPosZ(4, 20))
|
||||
ITEM(EditString, filename, HSizePosZ(60, 224).TopPosZ(4, 19))
|
||||
ITEM(Button, butOpen, SetLabel(t_("Open")).RightPosZ(172, 44).TopPosZ(4, 20))
|
||||
ITEM(Option, opShowNormals, SetLabel(t_("Show normals")).RightPosZ(-4, 96).TopPosZ(4, 16))
|
||||
ITEM(Option, opShowAxis, SetLabel(t_("Show axis")).RightPosZ(96, 68).TopPosZ(4, 16))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,20 @@ GLCanvas_demo::GLCanvas_demo()
|
|||
{
|
||||
CtrlLayout(*this, "GLCanvas demo. STL viewer");
|
||||
|
||||
opShowAxis.WhenAction = [&] {canvas.Refresh();};
|
||||
opShowNormals.WhenAction = [&] {canvas.Refresh();};
|
||||
|
||||
butOpen.WhenAction = [&] {
|
||||
try {
|
||||
WaitCursor waitcursor;
|
||||
|
||||
bool isText;
|
||||
String header;
|
||||
LoadStl(~filename, surf, isText, header);
|
||||
surf.GetPanelParams();
|
||||
surf.GetLimits();
|
||||
surf.GetSurface();
|
||||
surf.GetVolume();
|
||||
canvas.SetEnv(surf.env);
|
||||
} catch (Exc e) {
|
||||
Exclamation(DeQtf(e));
|
||||
|
|
@ -17,7 +25,9 @@ GLCanvas_demo::GLCanvas_demo()
|
|||
};
|
||||
|
||||
canvas.WhenPaint = [&] {
|
||||
canvas.PaintSurface(surf, Green(), true, false);
|
||||
if (opShowAxis)
|
||||
canvas.PaintAxis(0, 0, 0, surf.env.LenRef()/4.);
|
||||
canvas.PaintSurface(surf, Green(), true, ~opShowNormals);
|
||||
};
|
||||
|
||||
Sizeable().Zoomable();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue