Extensible 3D (X3D)
Part 1: Architecture and base components

35 Layering component

# 35.1 Introduction

## 35.1.1 Name

The name of this component is "Layering". This name shall be used when referring to this component in the COMPONENT statement (see 7.2.5.4 Component statement).

## 35.1.2 Overview

This subclause describes the Layering component of this International Standard. This includes how to layer a set of subscene layers into a composite scene. Table 35.1 provides links to the major topics in this subclause.

Table 35.1 — Topics

35.1 Introduction 35.1.1 Name 35.1.2 Overview 35.2 Concepts 35.2.1 Overview of layering 35.2.2 Layer sets 35.2.3 Layers 35.2.4 Viewports 35.3 Abstract types 35.3.1 X3DLayerNode 35.3.2 X3DViewportNode 35.4 Node reference 35.4.1 Layer 35.4.2 LayerSet 35.4.3 Viewport 35.5 Support levels Table 35.1 — Topics Table 35.2 — Layering component support levels

## 35.2 Concepts

### 35.2.1 Overview of layering

A scene is embodied by the basic concept of layering. A scene is defined to consist of a sequence of layers and the order in which they are to be rendered.

### 35.2.2 Layer sets

A layer set is defined to be an ordered list of X3DLayerNode nodes that form a scene. The layers are assigned ordinals according to their position in the list in the LayerSet node. The rendering order is specified by the order field. Thus, the layer first specified in the order field will be the first layer rendered and will appear to be below any other layers. The layer last specified in the order field will be the last layer rendered and will correspondingly appear to be on top of all other layers.

The LayerSet node may make access to some of its content public by using the EXPORT statement to identify public names.

Only one LayerSet node is allowed and shall be a root node.

### 35.2.3 Layers

Each subscene is specified by a single X3DLayerNode node that contains its definition. The X3DLayerNode nodes may contain any child nodes allowed in grouping nodes. Hence, X3DLayerNode nodes may be used to create special effects such as heads up displays or non-transforming control elements. Each X3DLayerNode node contains its own binding stacks and thus has its own viewpoints and navigation.

### 35.2.4 Viewports

The output to a surface can be constrained further by using an X3DViewportNode node. These nodes are special grouping nodes that each define a set of clipping bounds within the extent of a surface within which the children nodes of the X3DViewportNode will appear. This provides support for the typical front/side/back/oblique views used by CAD systems.

## 35.3 Abstract types

### 35.3.1 X3DLayerNode

    X3DLayerNode : X3DNode, X3DPickableObject {
      SFNode   [in,out] metadata    NULL  [X3DMetadataObject]
      MFString [in,out] objectType  "ALL" ["ALL","NONE","TERRAIN",...]
      SFBool   [in,out] pickable    TRUE
      SFNode   [in,out] viewport    NULL  [X3DViewportNode]
      SFBool   [in out] visible     TRUE
    }

The X3DLayerNode abstract node type is the base node type for layer nodes.

The pickable field determines if pick traversal is to be performed for this layer. An X3DLayerNode node specified with pickable set to FALSE will does not participate in picking operations.

The viewport field constrains the output of the layer to a sub-region of the render surface.

The visible field specifies whether or not the content within a node is visually displayed. The value of this field has no effect on animation behaviors, collision behaviors, event passing, or other non-visual characteristics.

### 35.3.2 X3DViewportNode

    X3DViewportNode : X3DGroupingNode {
      MFNode  [in]     addChildren             [X3DChildNode]
      MFNode  [in]     removeChildren          [X3DChildNode]
      MFNode  [in,out] children       []       [X3DChildNode]
      SFBool  [in out] bboxDisplay    FALSE
      SFNode  [in,out] metadata       NULL     [X3DMetadataObject]
      SFBool  [in out] visible        TRUE
      SFVec3f []       bboxCenter     0 0 0    (-∞,∞)
      SFVec3f []       bboxSize       -1 -1 -1 (0,∞) or -1 -1 -1
    }

The X3DViewportNode abstract node type is the base node type for viewport nodes. Nodes of this type specify a boundary to which all content affected by the node is to be clipped. The boundary is specified in units appropriate for the surface on which the content is to be rendered.

More details on the children, addChildren, and removeChildren fields can be found in 10.2 Concepts.

The bboxCenter and bboxSize fields specify a bounding box that encloses the children. This is a hint that may be used for optimization purposes. The results are undefined if the specified bounding box is smaller than the actual bounding box of the children at any time. The default bboxSize value, (-1, -1, -1), implies that the bounding box is not specified and, if needed, shall be calculated by the browser. More details on the bboxCenter and bboxSize fields can be found in 10.2.2 Bounding boxes.

## 35.4 Node Reference

### 35.4.1 Layer

    Layer : X3DLayerNode {
      MFNode   [in]     addChildren          [X3DChildNode]
      MFNode   [in]     removeChildren       [X3DChildNode]
      MFNode   [in,out] children       []    [X3DChildNode]
      SFNode   [in,out] metadata       NULL  [X3DMetadataObject]
      MFString [in,out] objectType     "ALL" ["ALL","NONE","TERRAIN",...]
      SFBool   [in,out] pickable       TRUE
      SFNode   [in,out] viewport       NULL  [X3DViewportNode]
      SFBool   [in out] visible        TRUE
    }

The Layer node specifies a children field that contains a list of nodes that define the contents of the layer.

10.2.1 Grouping and children node types provides a description of the children, addChildren, and removeChildren fields.

### 35.4.2 LayerSet

    LayerSet : X3DNode {
      SFInt32 [in,out]  activeLayer 0    ([0,∞)
      MFNode  [in,out]  layers      []   [X3DLayerNode]
      SFNode  [in,out]  metadata    NULL [X3DMetadataObject]
      MFInt32 [in,out]  order       [0]  ([0,∞)
    }

The LayerSet node specifies a list of layers and a rendering order.

The activeLayer field specifies the layer in which navigation takes place.

The list defined by layers contains the constituent parts of the scene. Each layer is assigned an ordinal number depending on its position in the list. Ordinals start with the numeral 1 representing the first item in the list.

The list defined by order specifies the order in which the layers are rendered. The number specified correspond to the ordinals of the layers. The order field may contain repetitions of the ordinals in which case the layer is rendered again. If order contains numbers that are not ordinals assigned to layers, such numbers are ignored. Layers included in layers that are not listed in order are not rendered.

Object picking according to the pickable field of a Layer node occurs even if that Layer is not visible.

Nodes that are not part of a layer are considered to be the first nodes in layer 0.

### 35.4.3 Viewport

    Viewport : X3DViewportNode, X3DBoundedObject {
      MFNode  [in]     addChildren             [X3DChildNode]
      MFNode  [in]     removeChildren          [X3DChildNode]
      MFNode  [in,out] children       []       [X3DChildNode]
      MFFloat [in,out] clipBoundary   0 1 0 1  [0,1]
      SFBool  [in out] bboxDisplay    FALSE
      SFNode  [in,out] metadata       NULL     [X3DMetadataObject]
      SFBool  [in out] visible        TRUE
      SFVec3f []       bboxCenter     0 0 0    (-∞,∞)
      SFVec3f []       bboxSize       -1 -1 -1 (0,∞) or -1 -1 -1
    }

The Viewport node is a grouping node that specifies a set of rectangular clip boundaries against which the children nodes are clipped as they are rendered.

The clipBoundary field is specified in fractions of the normal render surface in the sequence left/right/bottom/top. When the children are rendered, the output will only appear in the specified subset of the render surface.

## 35.5 Support levels

The Layering component provides four levels of support as specified in Table 35.2. Level 1 provides the support for scenes and layers.

Table 35.2 — Layering component support levels

Level | Prerequisites | Nodes | Support
--- | --- | --- | ---
1 | Core 1; Grouping 1 |  |
|  | X3DLayerNode | n/a
|  | X3DViewportNode | n/a
|  | Layer | All fields fully supported.
|  | LayerSet | All fields fully supported.
|  | Viewport | All fields fully supported.