back-imp-u3d.mkxl /size: 3916 b    last modification: 2021-10-28 13:50
1%D \module
2%D   [       file=back-imp-u3d,
3%D        version=2009.04.15,
4%D          title=\CONTEXT\ Backend Macros,
5%D       subtitle=U3D Experiment,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D This is only a placeholder that demonstrates the usage of u3d resources. The
15%D user interface is rather messy an might be improved. The files and setup is
16%D derived from an example by Michael Vidiassov.
17
18\registerctxluafile{lpdf-u3d}{autosuffix}
19
20\endinput
21
22\starttext
23
24\startluaparameterset [u3d:myset:controls:1]
25    view = {
26        name = 'default',
27        bg = {1,1,1},
28        mag = 100,
29        coo = {0,0,0},
30        c2c = {0,0,1},
31        rot = {40,0,60},
32        roo = 6,
33        lights = 'CAD'
34    },
35    js = 'cloudq.js'
36\stopluaparameterset
37
38\startluaparameterset [u3d:myset:controls:2]
39    views = {
40        {
41            name = 'AnglePositioning',
42            bg = {1,1,1},
43            azimuth = 45,
44            altitude = 45,
45            roo = 50,
46            aac = 2.5,
47            lights = 'Artwork'
48        },
49        {
50            name = 'RotationPositioning',
51            bg = {1,1,1},
52            rot = {0,45,45},
53            roo = 50,
54            aac = 2.5,
55            lights = 'Artwork'
56        },
57        {
58            name = 'VectorPositioning',
59            bg = {1,0,0},
60            c2c = {1,1,math.sqrt(2)},
61            roo = 50,
62            aac = 2.5,
63            lights = 'CAD'
64        },
65        {
66            name = 'PositionPositioning',
67            bg = {1,0,0},
68            pos = {1+25,1+25,1+50/math.sqrt(2)},
69            aac = 2.5,
70            lights = 'CAD'
71        },
72        {
73            name = 'ortho',
74            bg = {1,1,1},
75            mag = 300,
76            lights = 'CAD',
77            crossection = {}
78        }
79    },
80    view = {
81        name = 'default',
82        bg = {1,1,1},
83        c2c = {-1,-1,0},
84        roo = 50,
85        aac = 2.5,
86        roll = 45,
87        lights = 'CAD',
88        crossection = {
89            normal = {-1,-1,-1},
90            transparent = true
91        },
92        nodes = {
93            {
94                name = 'xlabel',
95                visible = false
96            },
97            {
98                name = 'ylabel',
99                opacity = 0.5
100            },
101            {
102                name = 'zlabel',
103                rendermode = 'Wireframe'
104            }
105        }
106    }
107\stopluaparameterset
108
109\useexternalfigure
110  [cloudq]
111  [cloudq.u3d]
112  [width=0.7\textwidth,
113   height=.7\textwidth,
114   display=u3d:myset:display:1,
115   controls=u3d:myset:controls:1]
116
117\useexternalfigure
118  [axes]
119  [axes.u3d]
120  [width=0.7\textwidth,
121   height=.7\textwidth,
122   controls=u3d:myset:controls:1]
123
124\startluaparameterset[u3d:myset:display:2]
125    toolbar = true,
126    preview = 'cloudq.png'
127\stopluaparameterset
128
129\startluaparameterset[u3d:myset:display:3]
130    toolbar = true,
131    tree    = false,
132    preview = 'axes.png'
133\stopluaparameterset
134
135\startluaparameterset[u3d:myset:display:4]
136    toolbar = true,
137    tree    = false,
138    view    = {
139        name   = 'view',
140        bg     = {0.1,0.1,0.1},
141        c2c    = {-1,-1,0},
142        roo    = 50,
143        aac    = 2.5,
144        roll   = 45,
145        lights = 'Red'
146    }
147\stopluaparameterset
148
149\startluaparameterset[u3d:myset:display:5]
150    toolbar = true,
151    tree    = false,
152    view    = 'ortho'
153\stopluaparameterset
154
155\placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]}
156\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:3]}
157\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:4]}
158\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]}
159
160\stoptext
161