Debian Codegraph @

src/scene/x3d/castlefields_x3devent_descendants.inc

raw
1 {%MainUnit x3dfields.pas}
2 {
3 Copyright 2013-2018 Michalis Kamburelis.
4
5 This file is part of "Castle Game Engine".
6
7 "Castle Game Engine" is free software; see the file COPYING.txt,
8 included in this distribution, for details about the copyright.
9
10 "Castle Game Engine" is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 ----------------------------------------------------------------------------
15 }
16
17 { TX3DEvent descendants with comfortable Send methods.
18
19 Note that it is *not* necessary to use the descendants below to send events.
20 You can also use TX3DEvent class (not any descendant of it),
21 if only you set it's TX3DEvent.FieldClass right (to any concrete X3D field class,
22 like TSFFloat).
23 So using e.g. TSFFloatEvent is just a convenience shortcut.
24
25 These descendants only add easy Send methods, that can be type-checked
26 at compile-time. They are all just shortcuts for calling
27 the @link(Send Send(TX3DField, TX3DTime)) method.
28 They create a temporary instance of TX3DField for this purpose
29 (with field name equal to event name, this is useful for debugging
30 --- e.g. by Logger node). }
31
32 {$ifdef read_interface}
33 TSFBoolEvent = class(TX3DEvent)
34 public
35 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
36 procedure Send(const Value: boolean; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
37 procedure Send(const Value: boolean); overload;
38 end;
39
40 TSFDoubleEvent = class(TX3DEvent)
41 public
42 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
43 procedure Send(const Value: Double; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
44 procedure Send(const Value: Double); overload;
45 end;
46
47 TSFTimeEvent = class(TX3DEvent)
48 public
49 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
50 procedure Send(const Value: TFloatTime; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
51 procedure Send(const Value: TFloatTime); overload;
52 end;
53
54 TSFFloatEvent = class(TX3DEvent)
55 public
56 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
57 procedure Send(const Value: Single; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
58 procedure Send(const Value: Single); overload;
59 end;
60
61 TSFImageEvent = class(TX3DEvent)
62 public
63 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
64 end;
65
66 TSFLongEvent = class(TX3DEvent)
67 public
68 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
69 procedure Send(const Value: Int32; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
70 procedure Send(const Value: Int32); overload;
71 end;
72
73 TSFInt32Event = class(TX3DEvent)
74 public
75 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
76 procedure Send(const Value: Int32; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
77 procedure Send(const Value: Int32); overload;
78 end;
79
80 TSFMatrix3dEvent = class(TX3DEvent)
81 public
82 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
83 procedure Send(const Value: TMatrix3Double; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
84 procedure Send(const Value: TMatrix3Double); overload;
85 end;
86
87 TSFMatrix3fEvent = class(TX3DEvent)
88 public
89 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
90 procedure Send(const Value: TMatrix3; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
91 procedure Send(const Value: TMatrix3); overload;
92 end;
93
94 TSFMatrix4dEvent = class(TX3DEvent)
95 public
96 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
97 procedure Send(const Value: TMatrix4Double; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
98 procedure Send(const Value: TMatrix4Double); overload;
99 end;
100
101 TSFMatrix4fEvent = class(TX3DEvent)
102 public
103 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
104 procedure Send(const Value: TMatrix4; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
105 procedure Send(const Value: TMatrix4); overload;
106 end;
107
108 TSFNodeEvent = class(TX3DEvent)
109 public
110 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
111 end;
112
113 TSFRotationEvent = class(TX3DEvent)
114 public
115 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
116 procedure Send(const Value: TVector4; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
117 procedure Send(const Value: TVector4); overload;
118 end;
119
120 TSFStringEvent = class(TX3DEvent)
121 public
122 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
123 procedure Send(const Value: String; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
124 procedure Send(const Value: String); overload;
125 end;
126
127 TSFVec2dEvent = class(TX3DEvent)
128 public
129 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
130 procedure Send(const Value: TVector2Double; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
131 procedure Send(const Value: TVector2Double); overload;
132 end;
133
134 TSFVec2fEvent = class(TX3DEvent)
135 public
136 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
137 procedure Send(const Value: TVector2; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
138 procedure Send(const Value: TVector2); overload;
139 end;
140
141 TSFVec3dEvent = class(TX3DEvent)
142 public
143 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
144 procedure Send(const Value: TVector3Double; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
145 procedure Send(const Value: TVector3Double); overload;
146 end;
147
148 TSFVec3fEvent = class(TX3DEvent)
149 public
150 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
151 procedure Send(const Value: TVector3; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
152 procedure Send(const Value: TVector3); overload;
153 end;
154
155 TSFVec4dEvent = class(TX3DEvent)
156 public
157 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
158 procedure Send(const Value: TVector4Double; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
159 procedure Send(const Value: TVector4Double); overload;
160 end;
161
162 TSFVec4fEvent = class(TX3DEvent)
163 public
164 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
165 procedure Send(const Value: TVector4; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
166 procedure Send(const Value: TVector4); overload;
167 end;
168
169 TSFColorEvent = class(TX3DEvent)
170 public
171 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
172 procedure Send(const Value: TVector3; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
173 procedure Send(const Value: TVector3); overload;
174 end;
175
176 TSFColorRGBAEvent = class(TX3DEvent)
177 public
178 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
179 procedure Send(const Value: TCastleColor; const Time: TX3DTime; const PartialSend: TPartialSend = nil); overload;
180 procedure Send(const Value: TCastleColor); overload;
181 end;
182
183 { Universal input event that can receive value of any type.
184 It is used by some InstantReality extensions, like Logger.write.
185 InstantReality calls this event type XFAny. }
186 TXFAnyEvent = class(TX3DEvent)
187 public
188 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
189 end;
190
191 TMFBoolEvent = class(TX3DEvent)
192 public
193 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
194 end;
195
196 TMFDoubleEvent = class(TX3DEvent)
197 public
198 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
199 end;
200
201 TMFTimeEvent = class(TX3DEvent)
202 public
203 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
204 end;
205
206 TMFFloatEvent = class(TX3DEvent)
207 public
208 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
209 end;
210
211 TMFLongEvent = class(TX3DEvent)
212 public
213 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
214 end;
215
216 TMFInt32Event = class(TX3DEvent)
217 public
218 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
219 end;
220
221 TMFMatrix3dEvent = class(TX3DEvent)
222 public
223 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
224 end;
225
226 TMFMatrix3fEvent = class(TX3DEvent)
227 public
228 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
229 end;
230
231 TMFMatrix4dEvent = class(TX3DEvent)
232 public
233 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
234 end;
235
236 TMFMatrix4fEvent = class(TX3DEvent)
237 public
238 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
239 end;
240
241 TMFNodeEvent = class(TX3DEvent)
242 public
243 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
244 end;
245
246 TMFRotationEvent = class(TX3DEvent)
247 public
248 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
249 end;
250
251 TMFStringEvent = class(TX3DEvent)
252 public
253 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
254 end;
255
256 TMFVec2dEvent = class(TX3DEvent)
257 public
258 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
259 end;
260
261 TMFVec2fEvent = class(TX3DEvent)
262 public
263 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
264 end;
265
266 TMFVec3dEvent = class(TX3DEvent)
267 public
268 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
269 end;
270
271 TMFVec3fEvent = class(TX3DEvent)
272 public
273 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
274 end;
275
276 TMFVec4dEvent = class(TX3DEvent)
277 public
278 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
279 end;
280
281 TMFVec4fEvent = class(TX3DEvent)
282 public
283 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
284 end;
285
286 TMFColorEvent = class(TX3DEvent)
287 public
288 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
289 end;
290
291 TMFColorRGBAEvent = class(TX3DEvent)
292 public
293 constructor Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
294 end;
295 {$endif read_interface}
296
297 {$ifdef read_implementation}
298
299 { TSFBoolEvent --------------------------------------------------------------- }
300
301 constructor TSFBoolEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
302 begin
303 inherited Create(AParentNode, AName, TSFBool, AInEvent);
304 end;
305
306 procedure TSFBoolEvent.Send(const Value: boolean; const Time: TX3DTime; const PartialSend: TPartialSend);
307 var
308 Field: TX3DField;
309 begin
310 Field := CreateTemp(PartialSend);
311 (Field as TSFBool).Value := Value;
312 try
313 Send(Field, Time);
314 finally FreeTemp(Field) end;
315 end;
316
317 procedure TSFBoolEvent.Send(const Value: boolean);
318 begin
319 if (ParentNode <> nil) and
320 (TX3DNode(ParentNode).Scene <> nil) then
321 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
322 end;
323
324 { TSFDoubleEvent ------------------------------------------------------------- }
325
326 constructor TSFDoubleEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
327 begin
328 inherited Create(AParentNode, AName, TSFDouble, AInEvent);
329 end;
330
331 procedure TSFDoubleEvent.Send(const Value: Double; const Time: TX3DTime; const PartialSend: TPartialSend);
332 var
333 Field: TX3DField;
334 begin
335 Field := CreateTemp(PartialSend);
336 (Field as TSFDouble).Value := Value;
337 try
338 Send(Field, Time);
339 finally FreeTemp(Field) end;
340 end;
341
342 procedure TSFDoubleEvent.Send(const Value: Double);
343 begin
344 if (ParentNode <> nil) and
345 (TX3DNode(ParentNode).Scene <> nil) then
346 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
347 end;
348
349 { TSFTimeEvent --------------------------------------------------------------- }
350
351 constructor TSFTimeEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
352 begin
353 inherited Create(AParentNode, AName, TSFTime, AInEvent);
354 end;
355
356 procedure TSFTimeEvent.Send(const Value: TFloatTime; const Time: TX3DTime; const PartialSend: TPartialSend);
357 var
358 Field: TX3DField;
359 begin
360 Field := CreateTemp(PartialSend);
361 (Field as TSFTime).Value := Value;
362 try
363 Send(Field, Time);
364 finally FreeTemp(Field) end;
365 end;
366
367 procedure TSFTimeEvent.Send(const Value: TFloatTime);
368 begin
369 if (ParentNode <> nil) and
370 (TX3DNode(ParentNode).Scene <> nil) then
371 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
372 end;
373
374 { TSFFloatEvent -------------------------------------------------------------- }
375
376 constructor TSFFloatEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
377 begin
378 inherited Create(AParentNode, AName, TSFFloat, AInEvent);
379 end;
380
381 procedure TSFFloatEvent.Send(const Value: Single; const Time: TX3DTime; const PartialSend: TPartialSend);
382 var
383 Field: TX3DField;
384 begin
385 Field := CreateTemp(PartialSend);
386 (Field as TSFFloat).Value := Value;
387 try
388 Send(Field, Time);
389 finally FreeTemp(Field) end;
390 end;
391
392 procedure TSFFloatEvent.Send(const Value: Single);
393 begin
394 if (ParentNode <> nil) and
395 (TX3DNode(ParentNode).Scene <> nil) then
396 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
397 end;
398
399 { TSFImageEvent -------------------------------------------------------------- }
400
401 constructor TSFImageEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
402 begin
403 inherited Create(AParentNode, AName, TSFImage, AInEvent);
404 end;
405
406 { TSFLongEvent --------------------------------------------------------------- }
407
408 constructor TSFLongEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
409 begin
410 inherited Create(AParentNode, AName, TSFLong, AInEvent);
411 end;
412
413 procedure TSFLongEvent.Send(const Value: Int32; const Time: TX3DTime; const PartialSend: TPartialSend);
414 var
415 Field: TX3DField;
416 begin
417 Field := CreateTemp(PartialSend);
418 (Field as TSFLong).Value := Value;
419 try
420 Send(Field, Time);
421 finally FreeTemp(Field) end;
422 end;
423
424 procedure TSFLongEvent.Send(const Value: Int32);
425 begin
426 if (ParentNode <> nil) and
427 (TX3DNode(ParentNode).Scene <> nil) then
428 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
429 end;
430
431 { TSFInt32Event -------------------------------------------------------------- }
432
433 constructor TSFInt32Event.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
434 begin
435 inherited Create(AParentNode, AName, TSFInt32, AInEvent);
436 end;
437
438 procedure TSFInt32Event.Send(const Value: Int32; const Time: TX3DTime; const PartialSend: TPartialSend);
439 var
440 Field: TX3DField;
441 begin
442 Field := CreateTemp(PartialSend);
443 (Field as TSFInt32).Value := Value;
444 try
445 Send(Field, Time);
446 finally FreeTemp(Field) end;
447 end;
448
449 procedure TSFInt32Event.Send(const Value: Int32);
450 begin
451 if (ParentNode <> nil) and
452 (TX3DNode(ParentNode).Scene <> nil) then
453 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
454 end;
455
456 { TSFMatrix3dEvent ----------------------------------------------------------- }
457
458 constructor TSFMatrix3dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
459 begin
460 inherited Create(AParentNode, AName, TSFMatrix3d, AInEvent);
461 end;
462
463 procedure TSFMatrix3dEvent.Send(const Value: TMatrix3Double; const Time: TX3DTime; const PartialSend: TPartialSend);
464 var
465 Field: TX3DField;
466 begin
467 Field := CreateTemp(PartialSend);
468 (Field as TSFMatrix3d).Value := Value;
469 try
470 Send(Field, Time);
471 finally FreeTemp(Field) end;
472 end;
473
474 procedure TSFMatrix3dEvent.Send(const Value: TMatrix3Double);
475 begin
476 if (ParentNode <> nil) and
477 (TX3DNode(ParentNode).Scene <> nil) then
478 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
479 end;
480
481 { TSFMatrix3fEvent ----------------------------------------------------------- }
482
483 constructor TSFMatrix3fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
484 begin
485 inherited Create(AParentNode, AName, TSFMatrix3f, AInEvent);
486 end;
487
488 procedure TSFMatrix3fEvent.Send(const Value: TMatrix3; const Time: TX3DTime; const PartialSend: TPartialSend);
489 var
490 Field: TX3DField;
491 begin
492 Field := CreateTemp(PartialSend);
493 (Field as TSFMatrix3f).Value := Value;
494 try
495 Send(Field, Time);
496 finally FreeTemp(Field) end;
497 end;
498
499 procedure TSFMatrix3fEvent.Send(const Value: TMatrix3);
500 begin
501 if (ParentNode <> nil) and
502 (TX3DNode(ParentNode).Scene <> nil) then
503 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
504 end;
505
506 { TSFMatrix4dEvent ----------------------------------------------------------- }
507
508 constructor TSFMatrix4dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
509 begin
510 inherited Create(AParentNode, AName, TSFMatrix4d, AInEvent);
511 end;
512
513 procedure TSFMatrix4dEvent.Send(const Value: TMatrix4Double; const Time: TX3DTime; const PartialSend: TPartialSend);
514 var
515 Field: TX3DField;
516 begin
517 Field := CreateTemp(PartialSend);
518 (Field as TSFMatrix4d).Value := Value;
519 try
520 Send(Field, Time);
521 finally FreeTemp(Field) end;
522 end;
523
524 procedure TSFMatrix4dEvent.Send(const Value: TMatrix4Double);
525 begin
526 if (ParentNode <> nil) and
527 (TX3DNode(ParentNode).Scene <> nil) then
528 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
529 end;
530
531 { TSFMatrix4fEvent ----------------------------------------------------------- }
532
533 constructor TSFMatrix4fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
534 begin
535 inherited Create(AParentNode, AName, TSFMatrix4f, AInEvent);
536 end;
537
538 procedure TSFMatrix4fEvent.Send(const Value: TMatrix4; const Time: TX3DTime; const PartialSend: TPartialSend);
539 var
540 Field: TX3DField;
541 begin
542 Field := CreateTemp(PartialSend);
543 (Field as TSFMatrix4f).Value := Value;
544 try
545 Send(Field, Time);
546 finally FreeTemp(Field) end;
547 end;
548
549 procedure TSFMatrix4fEvent.Send(const Value: TMatrix4);
550 begin
551 if (ParentNode <> nil) and
552 (TX3DNode(ParentNode).Scene <> nil) then
553 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
554 end;
555
556 { TSFNodeEvent --------------------------------------------------------------- }
557
558 constructor TSFNodeEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
559 begin
560 inherited Create(AParentNode, AName, TSFNode, AInEvent);
561 end;
562
563 { TSFRotationEvent ----------------------------------------------------------- }
564
565 constructor TSFRotationEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
566 begin
567 inherited Create(AParentNode, AName, TSFRotation, AInEvent);
568 end;
569
570 procedure TSFRotationEvent.Send(const Value: TVector4; const Time: TX3DTime; const PartialSend: TPartialSend);
571 var
572 Field: TX3DField;
573 begin
574 Field := CreateTemp(PartialSend);
575 (Field as TSFRotation).Value := Value;
576 try
577 Send(Field, Time);
578 finally FreeTemp(Field) end;
579 end;
580
581 procedure TSFRotationEvent.Send(const Value: TVector4);
582 begin
583 if (ParentNode <> nil) and
584 (TX3DNode(ParentNode).Scene <> nil) then
585 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
586 end;
587
588 { TSFStringEvent ------------------------------------------------------------- }
589
590 constructor TSFStringEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
591 begin
592 inherited Create(AParentNode, AName, TSFString, AInEvent);
593 end;
594
595 procedure TSFStringEvent.Send(const Value: String; const Time: TX3DTime; const PartialSend: TPartialSend);
596 var
597 Field: TX3DField;
598 begin
599 Field := CreateTemp(PartialSend);
600 (Field as TSFString).Value := Value;
601 try
602 Send(Field, Time);
603 finally FreeTemp(Field) end;
604 end;
605
606 procedure TSFStringEvent.Send(const Value: String);
607 begin
608 if (ParentNode <> nil) and
609 (TX3DNode(ParentNode).Scene <> nil) then
610 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
611 end;
612
613 { TSFVec2dEvent -------------------------------------------------------------- }
614
615 constructor TSFVec2dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
616 begin
617 inherited Create(AParentNode, AName, TSFVec2d, AInEvent);
618 end;
619
620 procedure TSFVec2dEvent.Send(const Value: TVector2Double; const Time: TX3DTime; const PartialSend: TPartialSend);
621 var
622 Field: TX3DField;
623 begin
624 Field := CreateTemp(PartialSend);
625 (Field as TSFVec2d).Value := Value;
626 try
627 Send(Field, Time);
628 finally FreeTemp(Field) end;
629 end;
630
631 procedure TSFVec2dEvent.Send(const Value: TVector2Double);
632 begin
633 if (ParentNode <> nil) and
634 (TX3DNode(ParentNode).Scene <> nil) then
635 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
636 end;
637
638 { TSFVec2fEvent -------------------------------------------------------------- }
639
640 constructor TSFVec2fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
641 begin
642 inherited Create(AParentNode, AName, TSFVec2f, AInEvent);
643 end;
644
645 procedure TSFVec2fEvent.Send(const Value: TVector2; const Time: TX3DTime; const PartialSend: TPartialSend);
646 var
647 Field: TX3DField;
648 begin
649 Field := CreateTemp(PartialSend);
650 (Field as TSFVec2f).Value := Value;
651 try
652 Send(Field, Time);
653 finally FreeTemp(Field) end;
654 end;
655
656 procedure TSFVec2fEvent.Send(const Value: TVector2);
657 begin
658 if (ParentNode <> nil) and
659 (TX3DNode(ParentNode).Scene <> nil) then
660 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
661 end;
662
663 { TSFVec3dEvent -------------------------------------------------------------- }
664
665 constructor TSFVec3dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
666 begin
667 inherited Create(AParentNode, AName, TSFVec3d, AInEvent);
668 end;
669
670 procedure TSFVec3dEvent.Send(const Value: TVector3Double; const Time: TX3DTime; const PartialSend: TPartialSend);
671 var
672 Field: TX3DField;
673 begin
674 Field := CreateTemp(PartialSend);
675 (Field as TSFVec3d).Value := Value;
676 try
677 Send(Field, Time);
678 finally FreeTemp(Field) end;
679 end;
680
681 procedure TSFVec3dEvent.Send(const Value: TVector3Double);
682 begin
683 if (ParentNode <> nil) and
684 (TX3DNode(ParentNode).Scene <> nil) then
685 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
686 end;
687
688 { TSFVec3fEvent -------------------------------------------------------------- }
689
690 constructor TSFVec3fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
691 begin
692 inherited Create(AParentNode, AName, TSFVec3f, AInEvent);
693 end;
694
695 procedure TSFVec3fEvent.Send(const Value: TVector3; const Time: TX3DTime; const PartialSend: TPartialSend);
696 var
697 Field: TX3DField;
698 begin
699 Field := CreateTemp(PartialSend);
700 (Field as TSFVec3f).Value := Value;
701 try
702 Send(Field, Time);
703 finally FreeTemp(Field) end;
704 end;
705
706 procedure TSFVec3fEvent.Send(const Value: TVector3);
707 begin
708 if (ParentNode <> nil) and
709 (TX3DNode(ParentNode).Scene <> nil) then
710 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
711 end;
712
713 { TSFVec4dEvent -------------------------------------------------------------- }
714
715 constructor TSFVec4dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
716 begin
717 inherited Create(AParentNode, AName, TSFVec4d, AInEvent);
718 end;
719
720 procedure TSFVec4dEvent.Send(const Value: TVector4Double; const Time: TX3DTime; const PartialSend: TPartialSend);
721 var
722 Field: TX3DField;
723 begin
724 Field := CreateTemp(PartialSend);
725 (Field as TSFVec4d).Value := Value;
726 try
727 Send(Field, Time);
728 finally FreeTemp(Field) end;
729 end;
730
731 procedure TSFVec4dEvent.Send(const Value: TVector4Double);
732 begin
733 if (ParentNode <> nil) and
734 (TX3DNode(ParentNode).Scene <> nil) then
735 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
736 end;
737
738 { TSFVec4fEvent -------------------------------------------------------------- }
739
740 constructor TSFVec4fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
741 begin
742 inherited Create(AParentNode, AName, TSFVec4f, AInEvent);
743 end;
744
745 procedure TSFVec4fEvent.Send(const Value: TVector4; const Time: TX3DTime; const PartialSend: TPartialSend);
746 var
747 Field: TX3DField;
748 begin
749 Field := CreateTemp(PartialSend);
750 (Field as TSFVec4f).Value := Value;
751 try
752 Send(Field, Time);
753 finally FreeTemp(Field) end;
754 end;
755
756 procedure TSFVec4fEvent.Send(const Value: TVector4);
757 begin
758 if (ParentNode <> nil) and
759 (TX3DNode(ParentNode).Scene <> nil) then
760 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
761 end;
762
763 { TSFColorEvent -------------------------------------------------------------- }
764
765 constructor TSFColorEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
766 begin
767 inherited Create(AParentNode, AName, TSFColor, AInEvent);
768 end;
769
770 procedure TSFColorEvent.Send(const Value: TVector3; const Time: TX3DTime; const PartialSend: TPartialSend);
771 var
772 Field: TX3DField;
773 begin
774 Field := CreateTemp(PartialSend);
775 (Field as TSFColor).Value := Value;
776 try
777 Send(Field, Time);
778 finally FreeTemp(Field) end;
779 end;
780
781 procedure TSFColorEvent.Send(const Value: TVector3);
782 begin
783 if (ParentNode <> nil) and
784 (TX3DNode(ParentNode).Scene <> nil) then
785 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
786 end;
787
788 { TSFColorRGBAEvent ---------------------------------------------------------- }
789
790 constructor TSFColorRGBAEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
791 begin
792 inherited Create(AParentNode, AName, TSFColorRGBA, AInEvent);
793 end;
794
795 procedure TSFColorRGBAEvent.Send(const Value: TCastleColor; const Time: TX3DTime; const PartialSend: TPartialSend);
796 var
797 Field: TX3DField;
798 begin
799 Field := CreateTemp(PartialSend);
800 (Field as TSFColorRGBA).Value := Value;
801 try
802 Send(Field, Time);
803 finally FreeTemp(Field) end;
804 end;
805
806 procedure TSFColorRGBAEvent.Send(const Value: TCastleColor);
807 begin
808 if (ParentNode <> nil) and
809 (TX3DNode(ParentNode).Scene <> nil) then
810 Send(Value, TX3DNode(ParentNode).Scene.NextEventTime);
811 end;
812
813 { ---------------------------------------------------------------------------- }
814
815 constructor TXFAnyEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
816 begin
817 inherited Create(AParentNode, AName, TX3DField, AInEvent);
818 end;
819
820 constructor TMFBoolEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
821 begin
822 inherited Create(AParentNode, AName, TMFBool, AInEvent);
823 end;
824
825 constructor TMFDoubleEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
826 begin
827 inherited Create(AParentNode, AName, TMFDouble, AInEvent);
828 end;
829
830 constructor TMFTimeEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
831 begin
832 inherited Create(AParentNode, AName, TMFTime, AInEvent);
833 end;
834
835 constructor TMFFloatEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
836 begin
837 inherited Create(AParentNode, AName, TMFFloat, AInEvent);
838 end;
839
840 constructor TMFLongEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
841 begin
842 inherited Create(AParentNode, AName, TMFLong, AInEvent);
843 end;
844
845 constructor TMFInt32Event.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
846 begin
847 inherited Create(AParentNode, AName, TMFInt32, AInEvent);
848 end;
849
850 constructor TMFMatrix3dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
851 begin
852 inherited Create(AParentNode, AName, TMFMatrix3d, AInEvent);
853 end;
854
855 constructor TMFMatrix3fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
856 begin
857 inherited Create(AParentNode, AName, TMFMatrix3f, AInEvent);
858 end;
859
860 constructor TMFMatrix4dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
861 begin
862 inherited Create(AParentNode, AName, TMFMatrix4d, AInEvent);
863 end;
864
865 constructor TMFMatrix4fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
866 begin
867 inherited Create(AParentNode, AName, TMFMatrix4f, AInEvent);
868 end;
869
870 constructor TMFNodeEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
871 begin
872 inherited Create(AParentNode, AName, TMFNode, AInEvent);
873 end;
874
875 constructor TMFRotationEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
876 begin
877 inherited Create(AParentNode, AName, TMFRotation, AInEvent);
878 end;
879
880 constructor TMFStringEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
881 begin
882 inherited Create(AParentNode, AName, TMFString, AInEvent);
883 end;
884
885 constructor TMFVec2dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
886 begin
887 inherited Create(AParentNode, AName, TMFVec2d, AInEvent);
888 end;
889
890 constructor TMFVec2fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
891 begin
892 inherited Create(AParentNode, AName, TMFVec2f, AInEvent);
893 end;
894
895 constructor TMFVec3dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
896 begin
897 inherited Create(AParentNode, AName, TMFVec3d, AInEvent);
898 end;
899
900 constructor TMFVec3fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
901 begin
902 inherited Create(AParentNode, AName, TMFVec3f, AInEvent);
903 end;
904
905 constructor TMFVec4dEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
906 begin
907 inherited Create(AParentNode, AName, TMFVec4d, AInEvent);
908 end;
909
910 constructor TMFVec4fEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
911 begin
912 inherited Create(AParentNode, AName, TMFVec4f, AInEvent);
913 end;
914
915 constructor TMFColorEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
916 begin
917 inherited Create(AParentNode, AName, TMFColor, AInEvent);
918 end;
919
920 constructor TMFColorRGBAEvent.Create(AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean);
921 begin
922 inherited Create(AParentNode, AName, TMFColorRGBA, AInEvent);
923 end;
924
925 {$endif read_implementation}