Skip to content

Instantly share code, notes, and snippets.

@andreasplesch
Last active May 10, 2025 21:19
Show Gist options
  • Select an option

  • Save andreasplesch/5e2c6068d0495605198f9a20254c7519 to your computer and use it in GitHub Desktop.

Select an option

Save andreasplesch/5e2c6068d0495605198f9a20254c7519 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
<head>
<meta content='Prototype.x3d' name='title'/>
<meta content='X3D encodings example: defining a Prototype, demonstration of IS/connect definitions.' name='description'/>
<meta content='Don Brutzman and Joe Williams' name='creator'/>
<meta content='1 June 2002' name='created'/>
<meta content='28 October 2019' name='modified'/>
<meta content='X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.4 Prototype example' name='specificationSection'/>
<meta content='https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#PrototypeExample' name='specificationUrl'/>
<meta content='https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Prototype.x3d' name='identifier'/>
<meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
<meta content='../license.html' name='license'/>
</head>
<Scene>
<WorldInfo title='Prototype.x3d'/>
<ProtoDeclare name='Box'>
<ProtoInterface>
</ProtoInterface>
<ProtoBody>
<Sphere/>
</ProtoBody>
</ProtoDeclare>
<!-- End of prototype -->
<NavigationInfo type='"EXAMINE"'/>
<!-- Use the Examine viewer -->
<Transform translation='0 0 0'>
<Shape>
<Appearance>
<Material />
</Appearance>
<Box/>
</Shape>
</Transform>
</Scene>
</X3D>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
<head>
<meta content='Prototype.x3d' name='title'/>
<meta content='X3D encodings example: defining a Prototype, demonstration of IS/connect definitions.' name='description'/>
<meta content='Don Brutzman and Joe Williams' name='creator'/>
<meta content='1 June 2002' name='created'/>
<meta content='28 October 2019' name='modified'/>
<meta content='X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.4 Prototype example' name='specificationSection'/>
<meta content='https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#PrototypeExample' name='specificationUrl'/>
<meta content='https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Prototype.x3d' name='identifier'/>
<meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
<meta content='../license.html' name='license'/>
</head>
<Scene>
<WorldInfo title='Prototype.x3d'/>
<ProtoDeclare name='Group'>
<ProtoInterface>
<field accessType='initializeOnly' name='legColor' type='SFColor' value='.8 .4 .7'/>
<field accessType='initializeOnly' name='topColor' type='SFColor' value='.6 .6 .1'/>
</ProtoInterface>
<ProtoBody>
<Transform>
<Transform translation='0.0 0.6 0.0'>
<!-- table top -->
<Shape>
<Appearance>
<Material DEF='TableTopMaterial'>
<IS>
<connect nodeField='diffuseColor' protoField='topColor'/>
</IS>
</Material>
</Appearance>
<Box size='1.2 0.2 1.2'/>
</Shape>
</Transform>
<Transform translation='-0.5 0.0 -0.5'>
<!-- first table leg -->
<Shape DEF='Leg'>
<Appearance>
<Material DEF='LegMaterial' diffuseColor='1.0 0.0 0.0'>
<IS>
<connect nodeField='diffuseColor' protoField='legColor'/>
</IS>
</Material>
</Appearance>
<Cylinder height='1.0' radius='0.1'/>
</Shape>
</Transform>
<Transform translation='0.5 0.0 -0.5'>
<!-- another table leg -->
<Shape USE='Leg'/>
</Transform>
<Transform translation='-0.5 0.0 0.5'>
<Shape USE='Leg'/>
<!-- another table leg -->
</Transform>
<Transform translation='0.5 0.0 0.5'>
<Shape USE='Leg'/>
<!-- another table leg -->
</Transform>
<!-- End of root Transform's children -->
</Transform>
<!-- End of root Transform -->
</ProtoBody>
</ProtoDeclare>
<!-- 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: -->
<NavigationInfo type='"EXAMINE"'/>
<!-- Use the Examine viewer -->
<Group legColor='1 0 0' topColor='0 1 0'/>
<Transform translation='2 0 0'>
<Group legColor='1 0 1' topColor='1 1 0'/>
</Transform>
<Transform translation='2 0 0'>
<Group legColor='1 0 1' topColor='1 1 0'>
<Shape>
<Appearance>
<Material transparency='0.5'/>
</Appearance>
<Box/>
</Shape>
</Group>
</Transform>
</Scene>
</X3D>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment