Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CircularCam.h

Go to the documentation of this file.
00001 /*
00002     Enki - a fast 2D robot simulator
00003     Copyright (C) 1999-2005 Stephane Magnenat <nct@ysagoon.com>
00004     Copyright (C) 2005 Laboratory of Intelligent Systems, EPFL, Lausanne
00005     See AUTHORS for details
00006 
00007     This program is free software; the authors of any publication 
00008     arising from research using this software are asked to add the 
00009     following reference:
00010     Enki - a fast 2D robot simulator part of the Teem framework
00011     http://teem.epfl.ch
00012     Stephane Magnenat <stephane.magnenat@epfl.ch>,
00013     Markus Waibel <markus.waibel@epfl.ch>
00014     Laboratory of Intelligent Systems, EPFL, Lausanne.
00015 
00016     You can redistribute this program and/or modify
00017     it under the terms of the GNU General Public License as published by
00018     the Free Software Foundation; either version 2 of the License, or
00019     (at your option) any later version.
00020 
00021     This program is distributed in the hope that it will be useful,
00022     but WITHOUT ANY WARRANTY; without even the implied warranty of
00023     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024     GNU General Public License for more details.
00025 
00026     You should have received a copy of the GNU General Public License
00027     along with this program; if not, write to the Free Software
00028     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029 */
00030 
00031 #ifndef __CIRCULARCAM_H
00032 #define __CIRCULARCAM_H
00033 
00034 #include <enki/Interaction.h>
00035 #include <enki/PhysicalEngine.h>
00036 
00037 #include <valarray>
00038 
00042 namespace Enki
00043 {
00045 
00047     struct PixelOperationFunctor
00048     {
00050         virtual ~PixelOperationFunctor() { }
00052         virtual void operator()(double &zBuffer2, An::Color &pixelBuffer, const double &objectDist2, const An::Color &objectColor) = 0;
00053     };
00054     
00056 
00057     class CircularCam : public LocalInteraction
00058     {
00059     protected:
00061         An::Vector positionOffset;
00063         double height;
00065         An::Vector absPos;
00067         double absOrientation;
00068 
00069     public:
00071         std::valarray<double> zbuffer;
00073         std::valarray<An::Color> image;
00075         double fieldOfView;
00077         double angleOffset;
00078         
00080         bool useFog;
00082         double fogDensity;
00084         An::Color lightThreshold;
00085         
00087         PixelOperationFunctor *pixelOperation;
00088 
00089     public :
00091         CircularCam(Robot *owner, An::Vector pos, double height, double orientation, double fieldOfView, unsigned pixelCount);
00093         virtual ~CircularCam(){}
00094         virtual void init();
00095         virtual void objectStep (double dt, PhysicalObject *po, World *w);
00096         virtual void wallsStep(World *w);
00097         virtual void finalize(double dt);
00098         
00100         An::Point getAbsolutePosition(void) { return absPos; }
00102         double getAbsoluteOrientation(void) { return absOrientation; }
00103         
00104     protected:
00106         double interpolateLinear(double s0, double s1, double sv, double d0, double d1);
00108         void drawTexturedLine(const An::Point &p0, const An::Point &p1, const An::Texture &texture);
00109     };
00110 }
00111 #endif
00112 

Generated on Mon Oct 24 17:33:58 2005 for Enki by  doxygen 1.4.2