1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
3
<X3D profile='Full' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
5
<meta name='comment' content='World of Titania'/>
6
<meta name='created' content='Fri, 11 Sep 2015 17:20:16 GMT'/>
7
<meta name='creator' content='Holger Seelig'/>
8
<meta name='generator' content='Titania V1.4.9, http://titania.create3000.de'/>
9
<meta name='identifier' content='file:///home/holger/Projekte/Cobweb/cobweb.js/tests/Components/Text/horizontal.x3d'/>
10
<meta name='modified' content='Tue, 30 Aug 2016 04:07:18 GMT'/>
11
<meta name='title' content='Text'/>
14
<ProtoDeclare name='LineRectangle2D'>
17
coordIndex='0, 1, 2, 3, 0, -1'>
19
point='-0.5 -0.5 0, 0.5 -0.5 0, 0.5 0.5 0, -0.5 0.5 0'/>
23
<ProtoDeclare name='BBox2'>
25
<field accessType='inputOutput' type='SFVec3f' name='translation'/>
26
<field accessType='inputOutput' type='SFVec3f' name='scale' value='1 1 1'/>
27
<field accessType='inputOutput' type='SFColor' name='color' value='1 1 1'/>
32
<connect nodeField='translation' protoField='translation'/>
33
<connect nodeField='scale' protoField='scale'/>
36
translation='0.5 -0.5 0'>
41
<connect nodeField='emissiveColor' protoField='color'/>
45
<ProtoInstance name='LineRectangle2D' containerField='geometry'/>
52
title='Horizontal Text'>
53
<MetadataSet DEF='Titania'
55
reference='http://titania.create3000.de'>
56
<MetadataSet DEF='NavigationInfo' containerField='value'
58
reference='http://titania.create3000.de'>
59
<MetadataString DEF='type' containerField='value'
61
reference='http://titania.create3000.de'
64
<MetadataSet DEF='Viewpoint' containerField='value'
66
reference='http://titania.create3000.de'>
67
<MetadataDouble DEF='position' containerField='value'
69
reference='http://titania.create3000.de'
70
value='0.228690132498741, -0.0604688674211502, 1.71641170978546'/>
71
<MetadataDouble DEF='orientation' containerField='value'
73
reference='http://titania.create3000.de'
74
value='0.872291021747068, 0.488929089099191, 0.00753121584411764, 0.0424616187810779'/>
75
<MetadataDouble DEF='centerOfRotation' containerField='value'
76
name='centerOfRotation'
77
reference='http://titania.create3000.de'
78
value='0.192951887845993, 0.00326720159500837, -0.000781742099206895'/>
80
<MetadataSet DEF='Selection' containerField='value'
82
reference='http://titania.create3000.de'>
83
<MetadataSet DEF='previous' containerField='value'
85
reference='http://titania.create3000.de'/>
87
<MetadataSet DEF='AngleGrid' containerField='value'
89
reference='http://titania.create3000.de'>
90
<MetadataBoolean DEF='enabled' containerField='value'
92
reference='http://titania.create3000.de'
95
<MetadataSet DEF='Grid' containerField='value'
97
reference='http://titania.create3000.de'>
98
<MetadataBoolean DEF='enabled_1' containerField='value'
100
reference='http://titania.create3000.de'
102
<MetadataFloat DEF='rotation' containerField='value'
104
reference='http://titania.create3000.de'
105
value='1, 0, 0, 1.5708'/>
110
skyColor='0.2 0.2 0.2'/>
112
description='Viewpoint'
113
position='0.365518 -0.30449 8.30129'
114
orientation='0.872291021747068 0.488929089099191 0.00753121584411764 0.0424616187810779'
115
centerOfRotation='0.192952 0.0032672 -0.000781742'/>
116
<Transform DEF='Text'>
121
emissiveColor='1 1 1'/>
123
url='"http://cdn.rawgit.com/create3000/Library/master/Textures/Miscellaneous/lena.jpg", "https://cdn.rawgit.com/create3000/Library/master/Textures/Miscellaneous/lena.jpg", "http://rawgit.com/create3000/Library/master/Textures/Miscellaneous/lena.jpg", "https://rawgit.com/create3000/Library/master/Textures/Miscellaneous/lena.jpg"'/>
126
string='"Bgre", "good old", "Texts", "today!"'
127
length='1.66694, 2.95728, 1.82503, 2.17687'
130
family='"Ubuntu", "SANS"'
132
justify='"MIDDLE", "FIRST"'/>
136
<Transform DEF='RedBox'
137
translation='-0.5 0.5 0'>
142
transparency='0.854167'/>
148
<Transform DEF='GreenBox'
149
translation='-0.5 -0.5 0'>
154
transparency='0.916667'/>
160
<Transform DEF='BlueBox'
161
translation='-0.5 -1.5 0'>
172
<Transform DEF='YellowBox'
173
translation='6 1.5 0'
179
transparency='0.49'/>
185
<Transform DEF='LineBounds'
186
translation='-1.47864 0.700938 0'>
187
<ProtoInstance name='BBox2'>
188
<fieldValue name='translation' value='0.64517 0 0'/>
189
<fieldValue name='scale' value='1.66694 0.889938 1'/>
190
<fieldValue name='color' value='1 0 1'/>
192
<ProtoInstance name='BBox2'>
193
<fieldValue name='translation' value='0 -0.889938 0'/>
194
<fieldValue name='scale' value='2.95728 1 1'/>
195
<fieldValue name='color' value='0 1 0'/>
197
<ProtoInstance name='BBox2'>
198
<fieldValue name='translation' value='0.566125 -1.88994 0'/>
199
<fieldValue name='scale' value='1.82503 1 1'/>
200
<fieldValue name='color' value='0 0 1'/>
202
<ProtoInstance name='BBox2'>
203
<fieldValue name='translation' value='0.390205 -2.88994 0'/>
204
<fieldValue name='scale' value='2.17687 1 1'/>
205
<fieldValue name='color' value='1 1 0'/>
208
<Transform DEF='TextBounds'
209
translation='-1.47864 0.700938 0'
210
scale='2.95728 3.88594 1'>
211
<ProtoInstance name='BBox2'/>
213
<Script DEF='Bounds'>
214
<field accessType='inputOnly' type='MFVec2f' name='set_lineBounds'/>
215
<field accessType='inputOnly' type='SFVec2f' name='set_textBounds'/>
216
<field accessType='outputOnly' type='SFVec3f' name='translation_changed'/>
217
<field accessType='outputOnly' type='SFVec3f' name='scale_changed'/>
218
<field accessType='initializeOnly' type='SFNode' name='lineBounds'>
219
<Transform USE='LineBounds'/>
221
<field accessType='initializeOnly' type='MFColor' name='color' value='1 0 1, 0 1 0, 0 0 1, 1 1 0, 0 1 1, 1 0 0'/>
222
<field accessType='initializeOnly' type='SFNode' name='text'>
233
function get_normalizedMajorAlignment (majorAlignment, normal)
235
if (majorAlignment == 'END')
236
return normal ? END : BEGIN;
238
if (majorAlignment == 'MIDDLE')
241
return normal ? BEGIN : END;
245
function get_majorAlignment (index)
247
if (text .fontStyle .horizontal)
249
var major = get_normalizedMajorAlignment (text .fontStyle .justify [0], text .fontStyle .leftToRight);
252
return text .textBounds .x - text .lineBounds [index] .x;
255
return (text .textBounds .x - text .lineBounds [index] .x) / 2;
260
var major = get_normalizedMajorAlignment (text .fontStyle .justify [0], text .fontStyle .topToBottom);
263
return -text .textBounds .y + text .lineBounds [index] .y;
266
return (-text .textBounds .y + text .lineBounds [index] .y) / 2;
271
function set_lineBounds (value, time)
273
var transforms = new MFNode ();
279
for (var i = 0; i < value .length; ++ i)
281
var transform = Browser .currentScene .createProto ('BBox2');
283
if (text .fontStyle .horizontal)
285
transform .translation = new SFVec3f (get_majorAlignment (i),
286
text .fontStyle .topToBottom ? y : y - text .textBounds .y,
288
y += text .fontStyle .topToBottom ? -value [i] .y : value [i] .y;
290
transform .scale = new SFVec3f (value [i] .x,
291
text .fontStyle .topToBottom ? value [i] .y : -value [i] .y,
296
transform .translation = new SFVec3f (text .fontStyle .leftToRight ? x : x + text .textBounds .x,
297
get_majorAlignment (i),
300
x += text .fontStyle .leftToRight ? value [i] .x : -value [i] .x;
302
transform .scale = new SFVec3f (text .fontStyle .leftToRight ? value [i] .x : -value [i] .x,
307
transform .color = color [i % color .length];
309
transforms [transforms .length] = transform;
312
lineBounds .children = transforms;
315
function set_textBounds (value, time)
317
scale_changed = new SFVec3f (value .x, value .y, 1);
321
<ROUTE fromNode='Text_1' fromField='origin' toNode='LineBounds' toField='set_translation'/>
322
<ROUTE fromNode='Text_1' fromField='lineBounds' toNode='Bounds' toField='set_lineBounds'/>
323
<ROUTE fromNode='Text_1' fromField='textBounds' toNode='Bounds' toField='set_textBounds'/>
324
<ROUTE fromNode='Text_1' fromField='origin' toNode='TextBounds' toField='set_translation'/>
325
<ROUTE fromNode='Bounds' fromField='scale_changed' toNode='TextBounds' toField='set_scale'/>