Syntax: DEF
The DEF syntax gives a name to a node.
XML Encoding
1 2 3 4 5 6 7 |
<Shape> <Appearance> <Material DEF='RedColor' diffuseColor='1.0 0.0 0.0'/> </Appearance> <!-- geometry ... --> </Shape> |
Classic Encoding
1 2 3 4 5 6 7 8 |
Shape { appearance Appearance { material DEF RedColor Material { diffuseColor 1.0 0.0 0.0 } } geometry ... } |
A sample use of node names
XML Encoding
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<Inline url='"table.x3dv"'/> <Transform translation='0.95 0 0'> <Inline DEF='Chair' url='"chair.x3dv"'/> </Transform> <Transform translation='-0.95 0 0' rotation='0 1 0 3.14'> <Inline USE='Chair'/> </Transform> <Transform translation='0 0 0.95' rotation='0 1 0 4.71318530717959'> <Inline USE='Chair'/> </Transform> <Transform translation='0 0 -0.95' rotation='0 1 0 1.57'> <Inline USE='Chair'/> </Transform> |
Classic Encoding
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 |
Inline { url "table.x3dv" } Transform { translation 0.95 0.0 0.0 children DEF Chair Inline { url "chair.x3dv" } } Transform { translation -0.95 0.0 0.0 rotation 0.0 1.0 0.0 3.14 children USE Chair } Transform { translation 0.0 0.0 0.95 rotation 0.0 1.0 0.0 -1.57 children USE Chair } Transform { translation 0.0 0.0 -0.95 rotation 0.0 1.0 0.0 1.57 children USE Chair } |