summaryrefslogtreecommitdiff
path: root/tex/context/base/back-u3d.mkiv
blob: 89d26ee41e830ace5122d60093606228867bed25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
%D \module
%D   [       file=back-u3d,
%D        version=2009.04.15,
%D          title=\CONTEXT\ Backend Macros,
%D       subtitle=U3D Experiment,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is only a placeholder that demonstrates the usage of u3d resources. The
%D user interface is rather messy an might be improved. The files and setup is
%D derived from an example by Michael Vidiassov.

\endinput

\starttext

\startluaparameterset [u3d:myset:controls:1]
    view = {
        name = 'default',
        bg = {1,1,1},
        mag = 100,
        coo = {0,0,0},
        c2c = {0,0,1},
        rot = {40,0,60},
        roo = 6,
        lights = 'CAD'
    },
    js = 'cloudq.js'
\stopluaparameterset

\startluaparameterset [u3d:myset:controls:2]
    views = {
        {
            name = 'AnglePositioning',
            bg = {1,1,1},
            azimuth = 45,
            altitude = 45,
            roo = 50,
            aac = 2.5,
            lights = 'Artwork'
        },
        {
            name = 'RotationPositioning',
            bg = {1,1,1},
            rot = {0,45,45},
            roo = 50,
            aac = 2.5,
            lights = 'Artwork'
        },
        {
            name = 'VectorPositioning',
            bg = {1,0,0},
            c2c = {1,1,math.sqrt(2)},
            roo = 50,
            aac = 2.5,
            lights = 'CAD'
        },
        {
            name = 'PositionPositioning',
            bg = {1,0,0},
            pos = {1+25,1+25,1+50/math.sqrt(2)},
            aac = 2.5,
            lights = 'CAD'
        },
        {
            name = 'ortho',
            bg = {1,1,1},
            mag = 300,
            lights = 'CAD',
            crossection = {}
        }
    },
    view = {
        name = 'default',
        bg = {1,1,1},
        c2c = {-1,-1,0},
        roo = 50,
        aac = 2.5,
        roll = 45,
        lights = 'CAD',
        crossection = {
            normal = {-1,-1,-1},
            transparent = true
        },
        nodes = {
            {
                name = 'xlabel',
                visible = false
            },
            {
                name = 'ylabel',
                opacity = 0.5
            },
            {
                name = 'zlabel',
                rendermode = 'Wireframe'
            }
        }
    }
\stopluaparameterset

\useexternalfigure
  [cloudq]
  [cloudq.u3d]
  [width=0.7\textwidth,
   height=.7\textwidth,
   display=u3d:myset:display:1,
   controls=u3d:myset:controls:1]

\useexternalfigure
  [axes]
  [axes.u3d]
  [width=0.7\textwidth,
   height=.7\textwidth,
   controls=u3d:myset:controls:1]

\startluaparameterset[u3d:myset:display:2]
    toolbar = true,
    preview = 'cloudq.png'
\stopluaparameterset

\startluaparameterset[u3d:myset:display:3]
    toolbar = true,
    tree    = false,
    preview = 'area.png'
\stopluaparameterset

\startluaparameterset[u3d:myset:display:4]
    toolbar = true,
    tree    = false,
    view    = {
        name   = 'view',
        bg     = {0.1,0.1,0.1},
        c2c    = {-1,-1,0},
        roo    = 50,
        aac    = 2.5,
        roll   = 45,
        lights = 'Red'
    }
\stopluaparameterset

\startluaparameterset[u3d:myset:display:5]
    toolbar = true,
    tree    = false,
    view    = 'ortho'
\stopluaparameterset

\placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]}
\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:3]}
\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:4]}
\placefigure[here]{none}{\externalfigure[axes]  [display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]}

\stoptext