Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

spheremesh.h

Go to the documentation of this file.
00001 // mesh.h
00002 // 
00003 // Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef _SPHEREMESH_H_
00011 #define _SPHEREMESH_H_
00012 
00013 #include <celmath/vecmath.h>
00014 #include <celmath/frustum.h>
00015 #include <celengine/mesh.h>
00016 #include <celengine/dispmap.h>
00017 
00023 class SphereMesh
00024 {
00025 public:
00026     SphereMesh(float radius, int _nRings, int _nSlices);
00027     SphereMesh(Vec3f size, int _nRings, int _nSlices);
00028     SphereMesh(Vec3f size,
00029                const DisplacementMap& dispmap,
00030                float height = 1.0f);
00031     SphereMesh(Vec3f size,
00032                int _nRings, int _nSlices,
00033                DisplacementMapFunc func,
00034                void* info);
00035     ~SphereMesh();
00036 
00038     Mesh* convertToMesh() const;
00039 
00040  private:
00041     void createSphere(float radius, int nRings, int nSlices);
00042     void generateNormals();
00043     void scale(Vec3f);
00044     void fixNormals();
00045     void displace(const DisplacementMap& dispmap, float height);
00046     void displace(DisplacementMapFunc func, void* info);
00047 
00048     int nRings;
00049     int nSlices;
00050     int nVertices;
00051     float* vertices;
00052     float* normals;
00053     float* texCoords;
00054     float* tangents;
00055     int nIndices;
00056     unsigned short* indices;
00057 };
00058 
00059 #endif // _SPHEREMESH_H_

Generated on Sat Jan 14 22:30:28 2006 for Celestia by  doxygen 1.4.1