/* osgCompute - Copyright (C) 2008-2009 SVT Group
 *                                                                     
 * This library 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 3 of
 * the License, or (at your option) any later version.
 *                                                                     
 * This library 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 Lesse General Public License for more details.
 *
 * The full license is in LICENSE file included with this distribution.
*/

#ifndef WARP_H
#define WARP_H 1

#include <osg/ref_ptr>
#include <vector_types.h>
#include <osgCompute/Module>
#include <osgCompute/Buffer>

namespace GeometryDemo
{
    class Warp : public osgCompute::Module 
    {
    public:
        Warp() : osgCompute::Module() {clearLocal();}
        
        META_Object( GeometryDemo, Warp )

		// Modules have to implement at least this
		// three methods:
        virtual bool init();
        virtual void launch( const osgCompute::Context& context ) const;
        virtual void acceptResource( osgCompute::Resource& resource );

		virtual void clear() { clearLocal(); osgCompute::Module::clear(); }
    protected:
        virtual ~Warp() { clearLocal(); }
        void clearLocal();

        unsigned int                                      _numBlocks;
        unsigned int                                      _numThreads;
        osg::ref_ptr<osgCompute::Buffer>                  _vertices;
		osg::ref_ptr<osgCompute::Buffer>				  _initNormals;
		osg::ref_ptr<osgCompute::Buffer>				  _initPos;

    private:
        Warp(const Warp&, const osg::CopyOp& ) {} 
        inline Warp &operator=(const Warp &) { return *this; }
    };

};

#endif // WARP_H
