back-u3d.mkiv /size: 3869 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=back-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\endinput
19
20\starttext
21
22\startluaparameterset [u3d:myset:controls:1]
23    view = {
24        name = 'default',
25        bg = {1,1,1},
26        mag = 100,
27        coo = {0,0,0},
28        c2c = {0,0,1},
29        rot = {40,0,60},
30        roo = 6,
31        lights = 'CAD'
32    },
33    js = 'cloudq.js'
34\stopluaparameterset
35
36\startluaparameterset [u3d:myset:controls:2]
37    views = {
38        {
39            name = 'AnglePositioning',
40            bg = {1,1,1},
41            azimuth = 45,
42            altitude = 45,
43            roo = 50,
44            aac = 2.5,
45            lights = 'Artwork'
46        },
47        {
48            name = 'RotationPositioning',
49            bg = {1,1,1},
50            rot = {0,45,45},
51            roo = 50,
52            aac = 2.5,
53            lights = 'Artwork'
54        },
55        {
56            name = 'VectorPositioning',
57            bg = {1,0,0},
58            c2c = {1,1,math.sqrt(2)},
59            roo = 50,
60            aac = 2.5,
61            lights = 'CAD'
62        },
63        {
64            name = 'PositionPositioning',
65            bg = {1,0,0},
66            pos = {1+25,1+25,1+50/math.sqrt(2)},
67            aac = 2.5,
68            lights = 'CAD'
69        },
70        {
71            name = 'ortho',
72            bg = {1,1,1},
73            mag = 300,
74            lights = 'CAD',
75            crossection = {}
76        }
77    },
78    view = {
79        name = 'default',
80        bg = {1,1,1},
81        c2c = {-1,-1,0},
82        roo = 50,
83        aac = 2.5,
84        roll = 45,
85        lights = 'CAD',
86        crossection = {
87            normal = {-1,-1,-1},
88            transparent = true
89        },
90        nodes = {
91            {
92                name = 'xlabel',
93                visible = false
94            },
95            {
96                name = 'ylabel',
97                opacity = 0.5
98            },
99            {
100                name = 'zlabel',
101                rendermode = 'Wireframe'
102            }
103        }
104    }
105\stopluaparameterset
106
107\useexternalfigure
108  [cloudq]
109  [cloudq.u3d]
110  [width=0.7\textwidth,
111   height=.7\textwidth,
112   display=u3d:myset:display:1,
113   controls=u3d:myset:controls:1]
114
115\useexternalfigure
116  [axes]
117  [axes.u3d]
118  [width=0.7\textwidth,
119   height=.7\textwidth,
120   controls=u3d:myset:controls:1]
121
122\startluaparameterset[u3d:myset:display:2]
123    toolbar = true,
124    preview = 'cloudq.png'
125\stopluaparameterset
126
127\startluaparameterset[u3d:myset:display:3]
128    toolbar = true,
129    tree    = false,
130    preview = 'axes.png'
131\stopluaparameterset
132
133\startluaparameterset[u3d:myset:display:4]
134    toolbar = true,
135    tree    = false,
136    view    = {
137        name   = 'view',
138        bg     = {0.1,0.1,0.1},
139        c2c    = {-1,-1,0},
140        roo    = 50,
141        aac    = 2.5,
142        roll   = 45,
143        lights = 'Red'
144    }
145\stopluaparameterset
146
147\startluaparameterset[u3d:myset:display:5]
148    toolbar = true,
149    tree    = false,
150    view    = 'ortho'
151\stopluaparameterset
152
153\placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]}
154\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:3]}
155\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:4]}
156\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]}
157
158\stoptext
159