    /***************************************************************************
                              mesh.h  -  description
                                 -------------------
        begin                : Wed Dec 6 2000
        copyright            : (C) 2000 by Jan Walter
        email                : jan@blender.nl
     ***************************************************************************/

    /***************************************************************************
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     ***************************************************************************/

    #ifndef MESH_H
    #define MESH_H

    #include <blender.h>

    struct PyObject;

    /**Blender meshes can be seen in the OOPS window as brown rectangles. They are constructed without a connection to an object but should be connected to one. This gives users the chance to "share" a mesh by connecting one mesh to different objects.
      *@author Jan Walter
      */

    class Mesh: public Blender {
    public:
    	Mesh();
    	~Mesh();
      /** A Blender mesh has always a unique name. The name you give as an argument is only a proposal for the real name. Blender will check if this name is already used and rename the mesh if necessary.  */
      Mesh(const char* name);
      /** Adds a list with 6 entries to the faces list. This might change in the future. The first 4 entries are indices to describe the vertices for a triangle or a quad. The decision if a quad is used or not is made by the 4th entry. If this is 0 then only the first 3 entries are used for an triangle. The 5th entry tells if the triangle (or quad) should be rendered as "smooth" (using vertex normals) or not. The last entry is the index of the material used for this face. */
      PyObject* addFace(int i1, int i2, int i3, int i4, int isSmooth, int matIndex);
      /** Adds the texture coordinates for one face to texcoords. The texture coordinates are stored for each face as a list of 4 sublists (for triangles just ignore the 4th sublist). Each of this sublists has 2 entries (u- and v- direction). */
      PyObject* addTexCoords(float u1, float v1, float u2, float v2, float u3, float v3, float u4, float v4);
      /** Replaces the filename (including path) for the texture. In the future more than only one texture might be used. */
      PyObject* addTexture(char* filename);
      /** Adds values for the list vertices, normals, and colors. The first 3 values are used for the vertex coordinates, the next 3 values for the vertex normal, and the last 3 (if used) for the vertex color. The color information has not to be specified. The default value for r (-1.0) means: Don't store any color information. */
      PyObject* addVertex(float vx, float vy, float vz, float nx, float ny, float nz, float r = -1.0, float g = 0.0, float b = 0.0);
      /** Instead of creating triangles and quads you can also create edges with addFace(...) now. This edges can be used by calling createTrianglesFromEdges() to triangulate a general polygon (even with holes). */
      PyObject* createTrianglesFromEdges();
      /** This is like pressing the TAB key in Blender. You enter edit mode and you can add vertices and faces within Python. Then you leave edit mode again and the data is transfered from Python to Blender. */
      PyObject* enterEditMode();
      /** When you leave edit mode all collected data (vertices, faces) are transfered from Python to Blender. */
      PyObject* leaveEditMode();
      /** After importing data (e.g. a DXF file) you might have doubled vertices because the file format does not allow to reuse the same vertices by using indices. This function removes doubled vertices within a precision value (at the moment you can't use the precision value from the interface; a value of 0.0003 is used) and is also called internally by createTrianglesFromEdges(). */
      PyObject* removeDoubles();
    private: // Private attributes
      /** All rectangles you can see in the OOPS window are instances of classes with an unique name for all instances of this class. Nevertheless the name of two instances of different classes can be the same. */
      char* name;
      /** This holds a list of vertices for usage within Python. A face uses the indices of this vertices. This allows to store the vertices efficient and to share the same vertex between different triangles or quads. */
      PyObject* vertices;
      /** This holds a list of vertex normals which can be used for "smooth" rendering. The number of elements in this list should be exactly the same as in the list for the vertices. */
      PyObject* normals;
      /** This holds a list of vertex colors. The list might be empty if no colors are used. But if they are used the list should be exactly of the same size as the list of vertices. */
      PyObject* colors;
      /** This holds a list of faces. At the moment a face is a list with 6 entries (integers). This might change in the future. The first 4 entries are indices to describe the vertices for a triangle or a quad. The decision if a quad is used or not is made by the 4th entry. If this is 0 then only the first 3 entries are used for an triangle. The 5th entry tells if the triangle (or quad) should be rendered as "smooth" (using vertex normals) or not. The last entry is the index of the material used for this face. */
      PyObject* faces;
      /** This holds a list of texture coordinates. The list might be empty but if used the list should have exactly the same size as the list of faces. The texture coordinates are stored for each face as a list of 4 sublists (for triangles just ignore the 4th sublist). Each of this sublists has 2 entries (u- and v- direction). */
      PyObject* texcoords;
      /** This holds the name (with path) of the used texture (if any). */
      PyObject* texture;
    };

    #endif