#VRML_SIM R2023b utf8
# template language: javascript
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2023b/projects/objects/geometries/protos/Extrusion.proto"

PROTO TriangleDeck [
  field SFVec2f size 1 1
  field SFVec3f translation 0 0 0.001
  field SFRotation rotation 1 0 0 0
  field SFFloat height 0.17
  field SFColor sideColour 1 1 1
  field SFColor topColour 0.1 0.1 0.1
  field SFBool locked FALSE
  field SFString name ""
] {
  Pose {
    translation IS translation
    rotation IS rotation
    children [
      Solid {
        translation 0 0 %<= -fields.height.value / 2 + 0.002 >%
        children [
          Shape {
            appearance PBRAppearance {
              baseColor IS sideColour
              roughness 1
              metalness 0.5
            }
            geometry DEF DECK Extrusion {
              crossSection [0.5 0.5, 0.5 -0.5, -0.5 0.5, 0.5 0.5]
              scale %<= fields.size.value.x >% %<= fields.size.value.y >%
              spine [0 0 0, 0 0 %<= fields.height.value >%]
              splineSubdivision 1
            }
          }
          Solid {
            translation 0 0 %<= fields.height.value + 0.002 >%
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor IS topColour
                  roughness 1
                  metalness 0
                }
                geometry IndexedFaceSet {
                  coord Coordinate {
                    point [
                      %<= -fields.size.value.x / 2 >% %<= -fields.size.value.y / 2 >% 0
                      %<= fields.size.value.x / 2 >% %<= -fields.size.value.y / 2 >% 0
                      %<= -fields.size.value.x / 2 >% %<= fields.size.value.y / 2 >% 0
                    ]
                  }
                  coordIndex [
                    0 1 2 0
                  ]
                }
                castShadows FALSE
              }
            ]
            name "Top of deck"
          }
        ]
        boundingObject USE DECK
        name IS name
        locked IS locked
      }
    ]
  }
}