import evas_types;

class Evas.Canvas3D.Mesh (Evas.Canvas3D.Object, Evas.Common_Interface, Efl.File)
{
   legacy_prefix: null;
   data: Evas_Canvas3D_Mesh_Data;

   methods {
      frame_vertex_data_set {
         [[Set the vertex data of the key frame of the given mesh.

           This function make evas read from the given buffer whenever it
           requires. If you want to release the buffer after calling this
           functions, use @.frame_vertex_data_copy_set instead.

           After setting the vertex data, further modifications should be
           protected by map/unmap pair.

           See also @.frame_vertex_data_map, @.frame_vertex_data_unmap.
         ]]
         params {
            @in frame: int; [[The number of the key frame.]]
            @in attrib: Evas.Canvas3D.Vertex_Attrib; [[Vertex attribute ID.]]
            @in stride: int; [[Stride to go to the next vertex (in bytes).]]
            @in data: const(void)*; [[Pointer to the vertex data buffer.]]
         }
      }

      frame_vertex_data_copy_set {
         [[Set the vertex data of the key frame of the given mesh by copying
           from a buffer. This function allocates internal vertex buffer and
           copy from the given buffer. So you can release the buffer. If you
           want to modify the vertex data use @.frame_vertex_data_map. After
           finishing the modifications, you should call @.frame_vertex_data_unmap.

           See also @.frame_vertex_data_set.
         ]]
         params {
            @in frame: int; [[The number of the key frame.]]
            @in attrib: Evas.Canvas3D.Vertex_Attrib; [[Vertex attribute ID.]]
            @in stride: int; [[Stride to go to the next vertex (in bytes).]]
            @in data: const(void)*; [[Pointer to the vertex data buffer.]]
         }
      }

      frame_vertex_data_map {
         [[Map the vertex buffer of the key frame of the given mesh.

           After manipulating the mapped buffer, @.frame_vertex_data_unmap
           should be called to properly download the data to the engine. If
           the data was set using @.frame_vertex_data_set, pointer to the
           original buffer will be returned. Otherwise, the returned pointer
           can differ every time calling this function.
         ]]
         return: void *; [[Starting address of the mapped vertex buffer.]]
         params {
            @in frame: int; [[The number of the key frame.]]
            @in attrib: Evas.Canvas3D.Vertex_Attrib; [[Vertex attribute ID.]]
         }
      }

      frame_vertex_data_unmap {
         [[Unmap the vertex buffer of the key frame of the given mesh.

           See also @.frame_vertex_data_map.
         ]]
         params {
            @in frame: int; [[The number of the key frame.]]
            @in attrib: Evas.Canvas3D.Vertex_Attrib; [[Vertex attribute ID.]]
         }
      }

      frame_vertex_stride_get @const {
         [[Get the vertex buffer stride of the key frame of the given mesh.

           This function returns valid stride only when the vertex buffer
           is mapped. If the data was set with @.frame_vertex_data_set, the
           original stride will be returned unchanged.
         ]]
         return: int; [[Stride to go to the next vertex (in bytes).]]
         params {
            @in frame: int; [[The number of the key frame.]]
            @in attrib: Evas.Canvas3D.Vertex_Attrib; [[Vertex attribute ID.]]
         }
      }

      index_data_set {
         [[Set the vertex index data of the given mesh.

           When the index data is set, Evas 3D assembles vertices using the
           index data. If you want to free the data buffer, use
           @.index_data_copy_set. Further modifications should be made
           within map/unmap pair.
         ]]
         params {
            @in format: Evas.Canvas3D.Index_Format; [[Vertex index data format.]]
            @in count: int; [[Vertex index count.]]
            @in indices: const(void)*; [[Pointer to the index data.]]
         }
      }


      index_data_copy_set {
         [[Set the vertex index data of the given mesh by copying from a
           buffer.

           This function allocates internal index buffer any copy data from
           the given buffer. Further modifications can be made within
           map/unmap pair.

           See also @.index_data_set.
         ]]
         params {
            @in format: Evas.Canvas3D.Index_Format; [[Vertex index data format.]]
            @in count: int; [[Vertex index count.]]
            @in indices: const(void)*; [[Pointer to the index data.]]
         }
      }

      index_format_get @const {
         [[Get the format of the index data of the given mesh.

           Returns valid format only when the index buffer is mapped. First
           map the index buffer and then query the properties of the mapped
           buffer. If the index data was set by @.index_data_set, the
           original format will be returned. Otherwise the format can differ
           every time you call the @.index_data_map function.
         ]]
         return: Evas.Canvas3D.Index_Format; [[Format of the index data.]]
      }

      index_count_get @const {
         [[Get the count of the index data of the given mesh.

           This function returns the index count of the last called data_set
           function.
         ]]
         return: int; [[Index data count.]]
      }

      index_data_map {
         [[Map the index buffer of the given mesh.

           @.index_data_unmap should be called after modifications. If the
           data was set using @.index_data_set, the original pointer will
           be returned, otherwise, the returned pointer may differ every
           time you call this function.
         ]]
         return: void *; [[Pointer to the mapped buffer.]]
      }

      index_data_unmap {
         [[Unmap the index buffer of the given mesh.

           See also @.index_data_map.
         ]]
      }

      frame_exist {
         [[Returns EINA_TRUE if frame was added and EINA_FALSE in other case.]]
         params {
            @in frame: int; [[Frame number.]]
         }
         return: Eina_Bool;
      }

      frame_add {
         [[Add a key frame to the given mesh.

           If specified frame is already exist, error message will be generated.
         ]]
         params {
            @in frame: int; [[The number of the key frame to be added.]]
         }
      }

      frame_del {
         [[Delete a key frame from the given mesh.]]
         params {
            @in frame: int; [[The number of the key frame to be added.]]
         }
      }

      fog_color_set {
         [[Set the fog color and density for the given mesh.]]
         params {
            @in r: Evas.Real; [[The red component of the fog color.]]
            @in g: Evas.Real; [[The green component of the fog color.]]
            @in b: Evas.Real; [[The blue component of the fog color.]]
            @in a: Evas.Real; [[The transparency of fog.]]
         }
      }
      fog_color_get {
         [[Set the fog color and density for the given mesh.]]
         params {
            @out r: Evas.Real; [[Pointer to receive red component of the fog color.]]
            @out g: Evas.Real; [[Pointer to receive green component of the fog color.]]
            @out b: Evas.Real; [[Pointer to receive blue component of the fog color.]]
            @out a: Evas.Real; [[Pointer to receive transparency of fog.]]
         }
      }
      blending_func_set {
         [[Set the blending function for given mesh.]]
         params {
            @in sfactor: Evas.Canvas3D.Blend_Func; [[Specifies how the red, green, blue,
                                                     and alpha source blending factors
                                                     are computed.
                                                   ]]
            @in dfactor: Evas.Canvas3D.Blend_Func; [[Specifies how the red, green, blue,
                                                     and alpha destination blending
                                                     factors are computed.
                                                   ]]
         }
      }
      blending_func_get {
         [[Get blending blending function for given mesh.]]
         params {
            @out sfactor: Evas.Canvas3D.Blend_Func; [[Pointer to receive source blendin factors key.]]
            @out dfactor: Evas.Canvas3D.Blend_Func; [[Pointer to receive destination blendin factors key.]]
         }
      }
      from_primitive_set {
         [[Set the data of given mesh frame from the given primitive.]]
         params {
            @in frame: int; [[Specifies data of which frame of given mesh will be set.]]
            @in primitive: Evas.Canvas3D.Primitive *; [[Specifies which data will be set.]]
         }
      }
      @property shade_mode {
         set {
            [[Set the shade mode of the given mesh.

              Default shade mode is EVAS_CANVAS3D_SHADE_MODE_VERTEX_COLOR.
            ]]
         }
         get {
            [[Get the shade mode of the given mesh.]]
         }
         values {
            mode: Evas.Canvas3D.Shade_Mode; [[The shade mode.]]
         }
      }
      @property color_pick_enable {
        set {
            [[Set posibility color picking.]]
         }
         get {
            [[Get status of color picking of the mesh.]]
         }
         values {
            enabled: bool; [[Posibility flag.]]
         }
      }
      @property vertex_count {
        set {
           [[Set the vertex count of the given mesh.

             Each key frame should have same vertex count to be properly
             interpolated. Key frames have their own vertex data and the
             data should have more vertices than the mesh's vertex count.

             Default vertex count is 0.
           ]]
        }
        get {
           [[Get the vertex count of the given mesh.]]
        }
        values {
           count: uint; [[Vertex count.]]
        }
      }
      @property fog_enable {
        set {
            [[Enable or disable fog effect for given mesh.

              Default fog is disabled.
            ]]
         }
         get {
            [[Get the enable status of fog effect for given mesh.]]
         }
         values {
            enabled: bool; [[Fog enabled status.]]
         }
      }

      @property alpha_test_enable {
        set {
            [[Get the enable status of alpha test for given mesh.

              Default alpha test disabled.
            ]]
         }
         get {
            [[Get the enable status of alpha test for given mesh.]]
         }
         values {
            enabled: bool; [[The alpha test status.]]
         }
      }

      @property alpha_func {
        set {
           [[Set the alpha func.

             The alpha test discards fragments depending on the outcome of
             a comparison between an incoming fragment's alpha value and a
             constant reference value. This func specifies the reference
             value and the comparison function.
           ]]
        }
        get {
            [[Get the reference value and the comparison function for alpha
              testing.
            ]]
        }
        values {
           comparison_func: Evas.Canvas3D.Comparison; [[The alpha comparison function.]]
           ref_value: Evas.Real; [[The reference value that incoming alpha values are compared to.]]
        }
      }

      @property blending_enable {
        set {
            [[Enable or disable blending for given mesh.]]
         }
         get {
            [[Get whether blending is enabled for the mesh.]]
         }
         values {
            blending: bool; [[The blending state.]]
         }
      }

      @property frame_material {
         set {
            [[Set the material of the key frame of the given mesh.

              Setting different materials for each key frame is useful for
              doing animations like GIF images or color changing animations.
            ]]
         }
         get {
            [[Get the material of the key frame of the given mesh.]]
         }
         keys {
            frame: int; [[The number of the key frame.]]
         }
         values {
            material: Evas.Canvas3D.Material *; [[The material to be set to the key frame.]]
         }
      }

      @property vertex_assembly {
         set {
            [[Set the vertex assembly of the given mesh.

              Vertex assembly defines how the engine organizes vertices into
              geometric primitives.

              Default vertex assembly is EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES.
            ]]
         }
         get {
            [[Get the vertex assembly of the given mesh.]]
         }
         values {
            assembly: Evas.Canvas3D.Vertex_Assembly; [[The vertex assembly.]]
         }
      }
      @property shadows_edges_filtering {
        set {
           [[Set the shadow edges blur parameters. 

             The averaging values in window is used for blurring. 
             User can set the size of window and num of points in window.
           ]]
        }
        get {
            [[Get the shadow edges blur parameters.]]
        }
        values {
           blur_level: int; [[Number of points within a bluring radius.]]
           edges_size: Evas.Real; [[The bluring radius.]]
        }
      }
      @property shadows_constant_bias {
        set {
           [[Set offset shadow toward object.]]
        }
        get {
            [[Get offset shadow toward object.]]
        }
        values {
           bias: Evas.Real; [[Offset.]]
        }
      }
   }
   implements {
      Eo.Base.constructor;
      Eo.Base.destructor;
      Evas.Canvas3D.Object.update_notify;
      Evas.Canvas3D.Object.change_notify;
      Efl.File.file.set;
      Efl.File.mmap.set;
      Efl.File.save;
   }

}
