material openmw_objects_base
{
    diffuse 1.0 1.0 1.0 1.0
    specular 0 0 0 0 1
    ambient 1.0 1.0 1.0
    emissive 0.0 0.0 0.0
    vertmode 0
    diffuseMap black.png
    normalMap
    emissiveMap
    specMap
    darkMap
    use_emissive_map false
    use_detail_map false
    use_diffuse_map false
    use_dark_map false
    emissiveMapUVSet 0
    detailMapUVSet 0
    diffuseMapUVSet 0
    darkMapUVSet 0
    use_parallax false

    scene_blend default
    depth_write default
    depth_check default
    alpha_rejection default
    transparent_sorting default
    polygon_mode default
    env_map false
    env_map_color 1 1 1

    pass
    {
        vertex_program openmw_objects_vertex
        fragment_program openmw_objects_fragment

        shader_properties
        {
            vertexcolor_mode $vertmode
            normalMap $normalMap
            emissiveMapUVSet $emissiveMapUVSet
            detailMapUVSet $detailMapUVSet
            diffuseMapUVSet $diffuseMapUVSet
            darkMapUVSet $darkMapUVSet
            emissiveMap $emissiveMap
            detailMap $detailMap
            diffuseMap $diffuseMap
            specMap $specMap
            darkMap $darkMap
            env_map $env_map
            env_map_color $env_map_color
            use_parallax $use_parallax
        }

        diffuse $diffuse
        specular $specular
        ambient $ambient
        emissive $emissive
        scene_blend $scene_blend
        alpha_rejection $alpha_rejection
        depth_write $depth_write
        depth_check $depth_check
        transparent_sorting $transparent_sorting
        polygon_mode $polygon_mode

        texture_unit diffuseMap
        {
            direct_texture $diffuseMap
            create_in_ffp $use_diffuse_map
            tex_coord_set $diffuseMapUVSet
        }

        texture_unit normalMap
        {
            direct_texture $normalMap
            // force automips here for now
            num_mipmaps 4
        }

        texture_unit darkMap
        {
            create_in_ffp $use_dark_map
            colour_op_ex modulate src_current src_texture
            alpha_op_ex modulate src_current src_texture
            direct_texture $darkMap
            tex_coord_set $darkMapUVSet
        }

        texture_unit detailMap
        {
            create_in_ffp $use_detail_map
            colour_op_ex modulate_x2 src_current src_texture
            direct_texture $detailMap
            tex_coord_set $detailMapUVSet
        }

        texture_unit emissiveMap
        {
            create_in_ffp $use_emissive_map
            colour_op add
            direct_texture $emissiveMap
            tex_coord_set $emissiveMapUVSet
        }

        texture_unit envMap
        {
            create_in_ffp $env_map
            env_map spherical
            anim_texture2 textures\magicitem\caust.dds 32 2
            colour_op add
        }

        texture_unit specMap
        {
            direct_texture $specMap
        }
      
        texture_unit shadowMap0
        {
            content_type shadow
            tex_address_mode clamp
            filtering none
        }
        texture_unit shadowMap1
        {
            content_type shadow
            tex_address_mode clamp
            filtering none
        }
        texture_unit shadowMap2
        {
            content_type shadow
            tex_address_mode clamp
            filtering none
        }
    }
}
