X3D Example Archives: Conformance Nist, Miscellaneous, EXTERNPROTO

 

VRML97 and ClassicVRML encodings use the term EXTERNPROTO, while XML and JSON encodings use the ExternProtoDeclare element.

ExternProtoDeclare refers to a ProtoDeclare node declaration provided in another file. ExternProtoDeclare interfaces are defined by field statements (without IS/connect statements). Hint: ExternProtoDeclare is a definition only, add corresponding ProtoInstance nodes to create new instances.

VRML97 and ClassicVRML encodings simply uses the prototype name to create an instance node, while XML and JSON encodings use the ProtoInstance element.

ProtoInstance creates an instance node of a locally or externally declared prototype definition. ProtoDeclare/ExternProtoDeclare definitions are abstract, corresponding ProtoInstance nodes are concrete. ProtoInstance nodes typically contain fieldValue statements to override default field values defined in the original ProtoDeclare statement. Hint: the node type of a ProtoInstance exactly matches the first node in the corresponding ProtoDeclare/ProtoBody declaration.

X3D Tooltips of interest: ExternProtoDeclare statement, field, ProtoDeclare statement, and ProtoInstance node with fieldValue statement.

X3D Specification sections of interest: Core component, 7.2 Concepts and 7.2.5.9 EXTERNPROTO statement.

X3D Examples Archives of related interest:

 
  11 X3D Models       X3D Model Descriptions
   different_name different name This tests browser ability to assign a different name to an EXTERNPROTO node from the name defined in the URL file. In this case the EXTERNPROTO name of "BallProto" is assigned to a PROTO named "Second_proto", which is in the URL file assigned to the EXTERNPROTO. As a result, a red Sphere should be rendered in this world.
   different_name_proto different name proto This is a collateral file used in other tests for this node.
   first_proto first proto This tests browser ability to select the first PROTO it finds in a wrl file if no PROTOname is supplied at the end of the URL in an EXTERNPROTO declaration. Three PROTOs are contained in the file first_proto_proto.x3d. The first PROTO generates a blue Sphere geometry. PROTO #2 generates a green Sphere geometry. PROTO #3 generates a white Sphere. Because no specific PROTO name is specified in the URL field of the EXTERNPROTO, the browser should select the first PROTO in the file, and render the blue Sphere.
   first_proto_file first proto file This is a collateral file used in other tests for this node.
   first_proto_proto first proto proto This is a collateral file used in other tests for this node.
   ignore_externproto ignore externproto This tests browser ability to ignore EXTERNPROTO statements in a file and select only PROTOs. The URL following an EXTERNPROTO references a file containing both a PROTO and an EXTERNPROTO statement. The PROTO generates a red Sphere geometry. The EXTERNPROTO references a file generating a green Sphere geometry. The browser should select the PROTO name, and generate a red Sphere geometry.
   multi_url_specific multi url specific This tests browser ability to select a specific PROTO if a #PROTOname is supplied at the end of the URL in a "list" of URLs. Two wrl file URLs are contained in the file URL list at the end of the EXTERNPROTO declaration. The first contains 3 PROTOs, however, none have # a name of "Red_sphere". The browser should continue its search for the PROTO name in the next URL. The next URL contains 3 PROTOs, one of which has a matching PROTO name. This PROTO should be used, and rendered as a red Sphere.
   multi_url_specific_nofile multi url specific nofile This tests browser ability to select a specific PROTO if a "#PROTOname" is supplied at the end of the URL in a "list" of URLs, but one of the URL files does not exist. Two wrl file URLs are contained in the file URL list at the end of the EXTERNPROTO declaration, however the first file does not exist. The second file contains 3 PROTOs, with one matching the PROTO name of "Red_sphere" specified after the EXTERNPROTO statement. Because the first file does not exist, the browser should continue its search for the PROTO name in the next URL, and find the matching PROTO name. This PROTO should be used, and rendered as a red Sphere.
   second_proto_file second proto file This is a collateral file used in other tests for this node.
   specific_proto specific proto This tests browser ability to select a specific PROTO in a wrl file if a "#PROTOname" is supplied at the end of the URL in an EXTERNPROTO declaration. Three PROTOs are contained in the file "first_proto_proto.x3d". Proto #1 generates a green Sphere geometry. PROTO #2 generates a red Sphere geometry. PROTO #3 generates a blue Sphere geometry. Because the second PROTO name is specified in the URL field of the EXTERNPROTO statement, the browser should select the second PROTO and render the red Sphere.
   specific_proto_proto specific proto proto This is a collateral file used in other tests for this node.

The X3D Resources: Examples page and Savage Developers Guide provide more information about the production of this archive.