<?xml version="1.0" ?>

<!--
  This world constains a shadow receiver ground plane with custom material for
  shading spot light shadows. No lighting is applied to the ground plane so it
  is just a flat color (hardcoded in the custom material fragement shader).
  The purpose is to demonstrate how to access the spot light shadow textures
  generated by ogre through shaders. Some shadow artifacts may be become visible
  on the sides which need to be manually filtered out in a full shader with
  lighting and proper spotlight FOV and attenuation.
  Note: The shaders also do not render shadows from the sun on the ground plane.
-->

<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <light type="point" name="point">
      <cast_shadows>true</cast_shadows>
      <pose>0.0 0.0 3.0 0 0 0</pose>
      <diffuse>0.8 0.8 0.8 1</diffuse>
      <specular>0.2 0.2 0.2 1</specular>
      <attenuation>
        <range>25</range>
        <constant>0.05</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <cast_shadows>true</cast_shadows>
    </light>

     <model name="ground_shadow_receiver_1">
      <pose>0 0 0.1 0 0 0</pose>
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>25 25</size>
            </plane>
          </geometry>
          <surface>
            <contact>
               <collide_bitmask>0xffff</collide_bitmask>
            </contact>
            <friction>
              <ode>
                <mu>100</mu>
                <mu2>50</mu2>
              </ode>
            </friction>
          </surface>
        </collision>
        <visual name="visual">
          <cast_shadows>false</cast_shadows>
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>25 25</size>
            </plane>
          </geometry>
          <material>
            <script>
              <uri>file://media/materials/scripts/point_light_shadow_demo.material</uri>
              <name>Gazebo/PointLightShadowDemo</name>
            </script>
          </material>
        </visual>
      </link>
    </model>

    <model name="box_0">
      <pose>0 0 0.5 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <material>
            <script><name>Gazebo/Blue</name></script>
          </material>
        </visual>
      </link>
    </model>

    <model name="box_1">
      <pose>2 0 0.5 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <material>
            <script><name>Gazebo/Blue</name></script>
          </material>
        </visual>
      </link>
    </model>

    <model name="box_2">
      <pose>1 4 0.5 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <material>
            <script><name>Gazebo/Blue</name></script>
          </material>
        </visual>
      </link>
    </model>

    <model name="sphere_0">
      <pose>-4 -4 0.5 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <sphere>
              <radius>1</radius>
            </sphere>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <sphere>
              <radius>1</radius>
            </sphere>
          </geometry>
          <material>
            <script><name>Gazebo/Blue</name></script>
          </material>
        </visual>
      </link>
    </model>

    <model name="sphere_1">
      <pose>-4 5 0.5 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <sphere>
              <radius>0.25</radius>
            </sphere>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <sphere>
              <radius>0.25</radius>
            </sphere>
          </geometry>
          <material>
            <script><name>Gazebo/Blue</name></script>
          </material>
        </visual>
      </link>
    </model>

    <model name="cylinder_0">
      <pose>7 -6 0.5 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <cylinder>
              <radius>1</radius>
              <length>1</length>
            </cylinder>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <cylinder>
              <radius>1</radius>
              <length>1</length>
            </cylinder>
          </geometry>
          <material>
            <script><name>Gazebo/Blue</name></script>
          </material>
        </visual>
      </link>
    </model>

  </world>
</sdf>
