Xj3D Layering Extensions Examples

Placing viewports in each corner

#X3D V3.2 utf8

PROFILE Immersive
COMPONENT Layering:1
COMPONENT EnvironmentalEffects:3
COMPONENT xj3d_Layering:1

DEF TG Transform {
  children Shape {
    geometry Box {}
    appearance Appearance {
      material Material {
        diffuseColor 1 0 0
      }
    }
  }
}
Background {
  skyColor 0.1 0.1 0.1
}
# A second layer to show that we do have stuff on screen
LayerSet {  
  order [ 0 1 2 3 4 5 ]
  layers [
    # Bottom left corner
    Layer {
      viewport ProportionalViewport {
        x -0.5
        y -0.5
        width 0.25
        height 0.25
      }
      children [
        TextureBackground {
            transparency 0.5
            skyColor 0 0.5 0
        }
        Transform {
          translation 0.3 0.4 0
          children Shape {
            geometry Box {}
            appearance Appearance {
              material Material {
                diffuseColor 1 1 0
              }
            }
          }
        }
      ]
    }

    # Bottom right corner
    Layer {
      viewport ProportionalViewport {
        x 0.5
        y -0.5
        width -0.25
        height 0.25
      }
      children [
        TextureBackground {
            transparency 0.5
            skyColor 0 0.5 0
        }
        Transform {
          translation 0.3 0.4 0
          children Shape {
            geometry Box {}
            appearance Appearance {
              material Material {
                diffuseColor 1 0 1
              }
            }
          }
        }
      ]
    }

    # Top right
    Layer {
      viewport ProportionalViewport {
        x 0.5
        y 0.5
        width -0.25
        height -0.25
      }
      children [
        TextureBackground {
            transparency 0.5
            skyColor 0 0.5 0
        }
        Transform {
          translation 0.3 0.4 0
          children Shape {
            geometry Box {}
            appearance Appearance {
              material Material {
                diffuseColor 0 1 1
              }
            }
          }
        }
      ]
    }

    # Top left
    Layer {
      viewport ProportionalViewport {
        x -0.5
        y 0.5
        width 0.25
        height -0.25
      }
      children [
        TextureBackground {
            transparency 0.5
            skyColor 0 0.5 0
        }
        Transform {
          translation 0.3 0.4 0
          children Shape {
            geometry Box {}
            appearance Appearance {
              material Material {
                diffuseColor 0 0 0
              }
            }
          }
        }
      ]
    }
  ]
}


[ Xj3D Homepage | Xj3D @ Web3d | Screenshots | Dev docs | Dev Releases | Contributors | Getting Started ]
Last updated: $Date: 2008-09-12 21:13:51 $