#VRML V2.0 utf8 # [X3D] VRML V4.0 utf8 # PROFILE Immersive # [X3D] version=4.0 # [X3D] noNamespaceSchemaLocation=/specifications/x3d-4.0.xsd # X3D-to-VRML-97 XSL translation autogenerated by X3dToVrml97.xslt # /x3d/content/X3dToVrml97.xslt # Transformation using XSLT processor: Saxonica # [head] # META "title" "TwoLeggedTablePrototype.x3d" # META "description" "X3D encodings example: defining a Prototype, demonstration of IS/connect definitions." # META "creator" "Don Brutzman and Joe Williams" # META "created" "1 June 2002" # META "modified" "28 September 2025" # META "specificationSection" "X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.4 Prototype example" # META "specificationUrl" "/specifications/X3Dv4Draft/ISO-IEC19776-1v4.0-CD/Part01/examples.html#PrototypeExample" # META "identifier" "/x3d/content/examples/Basic/X3dSpecifications/TwoLeggedTablePrototype.x3d" # META "generator" "X3D-Edit 4.0, /x3d/tools/X3D-Edit" # META "license" "../license.html" # [Scene] ========== ========== ========== WorldInfo { title "TwoLeggedTablePrototype.x3d" } NavigationInfo { } # Use the Examine viewer PROTO TwoColorTable [ field SFColor legColor .8 .4 .7 field SFColor topColor .6 .6 .1 ] { Transform { children [ Transform { translation 0.0 0.6 0.0 children [ # table top Shape { appearance Appearance { material DEF TableTopMaterial Material { diffuseColor IS topColor } } geometry Box { size 1.2 0.2 1.2 } } ] } Transform { translation -0.5 0.0 -0.5 children [ # first table leg DEF Leg Shape { appearance Appearance { material DEF LegMaterial Material { diffuseColor 1.0 0.0 0.0 diffuseColor IS legColor } } geometry Cylinder { height 1.0 radius 0.1 } } ] } Transform { translation 0.5 0.0 -0.5 children [ # another table leg USE Leg ] } Transform { translation -0.5 0.0 0.5 children [ USE Leg # another table leg ] } Transform { translation 0.5 0.0 0.5 children [ USE Leg # another table leg ] } # End of root Transform's children ] } } # End of prototype # The prototype is now defined. Although it contains a number of nodes, only the legColor and topColor fields are public. Instead of using the default legColor and topColor, this instance of the table has red legs and a green top: # show both DEF ProtoInstance and USE ProtoInstance DEF TwoTables Group { children [ Transform { translation -1 0 0 children [ DEF TCT TwoColorTable { legColor 1 0 0 topColor 0 1 0 } ] } Transform { translation 1 0 0 children [ USE TCT ] } ] }