/* -*- c++ -*- Copyright (C) 2003 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 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * * Copyright (C) 2004, 2006 Mekensleep * * Mekensleep * 24 rue vieille du temple * 75004 Paris * licensing@mekensleep.com * * 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. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: * Cedric PINSON * Loic Dachary * Igor Kravtchenko * */ #ifndef __OSGCAL__SUBMESHSOFTWARE_H__ #define __OSGCAL__SUBMESHSOFTWARE_H__ #include #include #include #include class CalSubmesh; class CalRenderer; class CalModel; namespace osgCal { class OSGCAL_EXPORT SubMeshSoftware : public osg::Geometry { protected: virtual ~SubMeshSoftware(); public: META_Object(osgCal, SubMeshSoftware); SubMeshSoftware(); SubMeshSoftware(CalModel* calModel, int meshId, int submeshId); SubMeshSoftware(const SubMeshSoftware&, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); bool create(void); bool update(void); virtual void drawImplementation(osg::State& state) const; #if OSG_VERSION_RELEASE != 9 && OSG_VERSION_MAJOR != 1 virtual bool computeBound() const; #else // OSG_VERSION_RELEASE != 9 && OSG_VERSION_MAJOR != 1 virtual osg::BoundingBox computeBound() const; #endif // OSG_VERSION_RELEASE != 9 && OSG_VERSION_MAJOR != 1 #if OSG_VERSION_RELEASE != 9 && OSG_VERSION_MAJOR != 1 inline virtual bool supports(osg::Drawable::PrimitiveFunctor&) const { return _supportsPrimitiveFunctor; } #else // OSG_VERSION_RELEASE != 9 && OSG_VERSION_MAJOR != 1 inline virtual bool supports(osg::PrimitiveFunctor&) const { return _supportsPrimitiveFunctor; } #endif // OSG_VERSION_RELEASE != 9 && OSG_VERSION_MAJOR != 1 // no bounding box, no picking if set to false (saves lots of computing) inline void setSupportsPrimitiveFunctor(bool supportsPrimitiveFunctor) { _supportsPrimitiveFunctor = supportsPrimitiveFunctor; } // the mesh is not drawn () inline bool isInvisible() const { return _invisible; } inline void setInvisible(bool invisible) { _invisible = invisible; } const std::string& getName(void) const { return mName; } void setName(const std::string& name) { mName = name; } const std::string& getMaterialName(void) { return mMaterialName; } void setMaterialName(const std::string& materialName) { mMaterialName = materialName; } osg::BoundingBox _staticbbox; protected: bool _supportsPrimitiveFunctor; bool _invisible; int _coreMeshId; int _coreSubmeshId; CalModel* _calModel; std::string mName; std::string mMaterialName; }; }; #endif