| 1 |
{ |
| 2 |
Copyright 2008-2018 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{$ifdef read_interface_nested} |
| 17 |
|
| 18 |
var |
| 19 |
{ List of Collada images (TAbstractTextureNode). X3DName of every instance |
| 20 |
comes from Collada "id" of <image> element (these are referred to |
| 21 |
by <init_from> contents from <surface>). } |
| 22 |
Images: TX3DNodeList; |
| 23 |
|
| 24 |
{$endif read_interface_nested} |
| 25 |
|
| 26 |
{$ifdef read_implementation_nested} |
| 27 |
|
| 28 |
{ Read <library_images> (Collada 1.4.x). Fills Images list. } |
| 29 |
procedure ReadLibraryImages(LibraryElement: TDOMElement); |
| 30 |
var |
| 31 |
I: TXMLElementIterator; |
| 32 |
Image: TImageTextureNode; |
| 33 |
ImageId, ImageUrl: String; |
| 34 |
begin |
| 35 |
I := LibraryElement.ChildrenIterator('image'); |
| 36 |
try |
| 37 |
while I.GetNext do |
| 38 |
if I.Current.AttributeString('id', ImageId) then |
| 39 |
begin |
| 40 |
Image := TImageTextureNode.Create(ImageId, BaseUrl); |
| 41 |
Images.Add(Image); |
| 42 |
ImageUrl := ReadChildText(I.Current, 'init_from'); |
| 43 |
if ImageUrl <> '' then |
| 44 |
Image.SetUrl([ImageUrl]); |
| 45 |
end; |
| 46 |
finally FreeAndNil(I) end; |
| 47 |
end; |
| 48 |
|
| 49 |
{$endif read_implementation_nested} |