Xj3D Overlay Extensions

Component: xj3d_overlay
Level: 1


Introduction

Name

The name of this component is "xj3d_overlay". This name shall be used when referring to this component in the COMPONENT statement (see ISO FDIS 19775-1:200x 7.2.5.4 Component statement).

Overview

The overlay extension is used to present screen-aligned geometry that is always rendered over the top of the existing geometry. It is useful for creating HUDs and other interactions where you need information always presented on screen.


Abstract Types

X3DSurfaceNode

X3DSurfaceNode : X3DNode {
   SFNode  [in, out] metadata           NULL [X3DMetadataObject]
   SFBool  [in, out] visible            TRUE
   SFVec2f [out]     surfaceSizeChanged
}
Defines a node that can be used as a screen-aligned surface.

X3DSurfaceChildNode

X3DSurfaceChildNode : X3DNodeType {
   SFNode  [in, out] metadata NULL [X3DMetadataObject]
   SFBool  [in, out] visible  TRUE
   SFVec2f []        bboxSize -1 -1
}
Defines a node that can be used as an item in a surface.

X3DSurfaceLayoutNode

X3DSurfaceLayoutNode : X3DSurfaceChildNode {
   MFNode  [in, out] children []     [X3DSurfaceChildNode]
   SFNode  [in, out] metadata NULL   [X3DMetadataObject]
   SFBool  [in, out] visible  TRUE
   SFVec2f []        bboxSize -1 -1
}
Defines a node that is usable in a surface, that can control the layout of the node on the screen.


Node Reference

Overlay

Overlay : SurfaceNode {
   MFNode  [in, out] layout             []
   SFNode  [in, out] metadata           NULL [X3DMetadataObject]
   SFBool  [in, out] visible            TRUE
   SFVec2f [out]     surfaceSizeChanged
}

BorderLayout

BorderLayout : X3DSurfaceLayoutNode {
   MFNode   [in, out] children           []     [X3DSurfaceChildNode]
   SFString [in, out] horizontalAlign    "LEFT" [LEFT, CENTER, RIGHT]
   SFFloat  [in, out] horizontalFraction 0      [0 - 1]    
   SFNode   [in, out] metadata           NULL	[X3DMetadataObject]
   SFString [in, out] verticalAlign      "TOP"  [TOP, CENTER, BOTTOM]
   SFFloat  [in, out] verticalFraction   0      [0 - 1]
   SFBool   [in, out] visible            TRUE
   SFVec2f  []        bboxSize           -1 -1
}
Lays out nodes relative to the edges of the screen. Horizontal and vertical are described as fractions at 0 to 1 where 0 is the edge nominated by the align field so an align of left and 0 will put the left edge of the item on the left edge of the screen where an align of right and 0 would put the right edge of the object on the left edge of the screen (ie completely out of the visible area)

GridLayout

GridLayout : X3DSurfaceLayoutNode {
   MFNode  [in, out] children []    [X3DSurfaceChildNode]
   SFVec2f [in, out] gridSize 1 1   
   SFNode  [in, out] metadata NULL  [X3DMetadataObject]
   SFBool  [in, out] visible  TRUE
   SFVec2f []        bboxSize -1 -1
}
Lays out the nodes in a fixed X-Y grid that resizes according to the largest dimension in each direction. All children are then forced to that size.

XYLayout

XYLayout : X3DSurfaceLayoutNode {
   MFNode  [in, out] children  []    [X3DSurfaceChildNode]
   SFNode  [in, out] metadata  NULL  [X3DMetadataObject]
   MFVec2f [in, out] positions []
   SFBool  [in, out] visible   TRUE
   SFVec2f []        bboxSize  -1 -1
}
Lays out the children at fixed X and Y location for the objects. Each child index in the children array uses the corresponding 2D position index in the positions array. However, note that although the position field is a float, all values are treated as integers and rounded down.

Image2D

Image2D : X3DSurfaceChildNode {
   SFNode  [in, out] metadata           NULL   [X3DMetadataObject]
   SFNode  [in, out] texture            NULL   [X3DTexture2DNode]
   SFBool  [in, out] enabled            TRUE
   SFBool  [in, out] visible            TRUE
   SFBool  [out]     isActive
   SFBool  [out]     isOver
   SFVec2f [out]     touchTime
   SFVec2f [out]     trackPoint_changed
   SFVec2f []        bboxSize           -1 -1
   SFBool  []        fixedSize          TRUE
   SFVec2i []        size               -1 -1
   SFBool  []        windowRelative     TRUE
}
Provides a flat image, and includes some mouse handling so that you can use it for tracking user input such as clicks.

Text2D

Text2D : X3DSurfaceChildNode {
   SFColor  [in, out] backgroundColor 0 0 0
   SFNode   [in, out] metadata        NULL   [X3DMetadataObject]
   SFNode   [in, out] fontStyle       NULL   [X3DFontStyleNode]
   SFString [in, out] string          ""
   SFColor  [in, out] textColor       1 1 1
   SFFloat  [in, out] transparency    1
   SFBool   [in, out] visible         TRUE
   SFVec2f  [] bboxSize               -1 -1
   SFBool   [] fixedSize              TRUE
   SFVec2i  [] size                   -1 -1
}
Provides flat, screen-aligned text.


Support Levels

This component defines 2 levels of conformance. The nodes are specified by the following levels:

LevelPrequisitesNodes/FeaturesSupport
Level 1 Core 1
Grouping 1
Shape 1
Rendering 1
Texturing 1
X3DSurfaceNode n/a
X3DSurfaceChildNode n/a
X3DSurfaceLayoutNode n/a
Overlay All fields fully supported
BorderLayout All fields fully supported
GridLayout All fields fully supported
XYLayout All fields fully supported
Image2D All fields fully supported
Level 2 Core 1
Grouping 1
Shape 1
Rendering 1
Texturing 1
Text 1
Text2D All fields fully supported

Examples

4 images located on the top center of the window.
Overlay {
  layout [
    BorderLayout {
      horizontalAlign "CENTER"
      horizontalFraction 0.5
      children [
        GridLayout {
          gridSize 1 4
          children [
            Image2D {
              bboxSize 64 32
              texture ImageTexture { url "button1.gif" }
            }
            Image2D {
              bboxSize 64 32
              texture ImageTexture { url "button2.gif" }
            }
            Image2D {
              bboxSize 64 32
              texture ImageTexture { url "button3.gif" }
            }
            Image2D {
              bboxSize 64 32
              texture ImageTexture { url "button4.gif" }
            }
          ]
        }
      ]
    }
  ]
}


[ Xj3D Homepage | Xj3D @ Web3d | Screenshots | Dev docs | Dev Releases | Contributors | Getting Started ]
Last updated: $Date: 2004-04-30 04:50:27 $