SphereSegment.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of the osgOcean library
00003  *
00004  * Copyright (C) 2009 Kim Bale
00005  * Copyright (C) 2009 The University of Hull, UK
00006  *
00007  * This program is free software; you can redistribute it and/or modify it under
00008  * the terms of the GNU Lesser General Public License as published by the Free Software
00009  * Foundation; either version 3 of the License, or (at your option) any later
00010  * version.
00011 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00015  * http://www.gnu.org/copyleft/lesser.txt.
00016  */
00017 
00018 #pragma once
00019 #include <osg/Geode>
00020 #include <osg/Geometry>
00021 
00022 class SphereSegment : public osg::Geode
00023 {
00024 public:
00025   SphereSegment(void);
00026 
00027   SphereSegment(float radius, unsigned int longitudeSteps, unsigned int lattitudeSteps, float longStart, float longEnd,
00028                 float latStart, float latEnd);
00029 
00030   SphereSegment(const SphereSegment& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
00031 
00032 protected:
00033   ~SphereSegment(void);
00034 
00035 public:
00036   // 0 >= longStart/longEnd <= 180
00037   // 0 >= latStart/latEnd <= 360
00038   void compute(float radius, unsigned int longitudeSteps, unsigned int lattitudeSteps, float longStart, float longEnd,
00039                float latStart, float latEnd);
00040 private:
00041   osg::Vec2 sphereMap(osg::Vec3& vertex, float radius);
00042 
00043   inline unsigned int idx(unsigned int r, unsigned int c, unsigned int row_len)
00044   {
00045     return c + r * row_len;
00046   }
00047 };


uwsim
Author(s): Mario Prats
autogenerated on Mon Oct 6 2014 08:24:07