/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 * Copyright 2008-2010 Pelican Mapping
 * http://osgearth.org
 *
 * osgEarth is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
#ifndef OSGEARTH_DROAM_ENGINE_MANIFOLD_H
#define OSGEARTH_DROAM_ENGINE_MANIFOLD_H 1

#include <osg/BoundingSphere>
#include <osg/Vec3>
#include <osgUtil/CullVisitor>

class MeshManager;
class MeshNode;

/** Abstract base class that represents the layout of a diamond mesh. */
class Manifold : public osg::Referenced
{
public:
    Manifold();

    /** builds the base diamond framework for this manifold. */
    virtual void initialize( MeshManager* mesh ) =0;

    /** update the culling status of the manifold based on a new eyepoint. */
    virtual void cull( osgUtil::CullVisitor* cv ) =0;

    /** calculates the midpoint between two coordinates */
    virtual osg::Vec3d midpoint( const osg::Vec3d& mapCoord0, const osg::Vec3d& mapCoord1 ) const =0;

    /** calculates an initial bound for the manifold. */
    virtual osg::BoundingSphere initialBound() const =0;

    /** creates a mesh node for a coordinate in manifold profile */
    virtual MeshNode createNode( const osg::Vec3d& manifoldCoord ) const =0;
};

#endif // OSGEARTH_DROAM_ENGINE_MANIFOLD_H

