00001 // Filename: geomSphere.h 00002 // Created by: drose (01Oct99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef GEOMSPHERE_H 00020 #define GEOMSPHERE_H 00021 00022 #include <pandabase.h> 00023 00024 #include "geom.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : GeomSphere 00028 // Description : A sphere primitive. This isn't actually a primitive 00029 // under OpenGL (or probably most backends), but it's 00030 // handy to be able to render a sphere from time to 00031 // time, and it may be a primitive on some backends. 00032 // This will render the best way the backend knows how 00033 // to render a sphere. 00034 // 00035 // This structure contains a sequence of spheres. Each 00036 // two consecutive vertices defines a sphere, where the 00037 // first vertex represents the center, and the second 00038 // vertex represents a point on the surface. 00039 //////////////////////////////////////////////////////////////////// 00040 class EXPCL_PANDA GeomSphere : public Geom { 00041 public: 00042 GeomSphere() : Geom() { } 00043 virtual Geom *make_copy() const; 00044 virtual void print_draw_immediate() const { } 00045 virtual void draw_immediate(GraphicsStateGuardianBase *gsg, GeomContext *gc); 00046 00047 virtual int get_num_vertices_per_prim() const { 00048 return 2; 00049 } 00050 virtual int get_num_more_vertices_than_components() const { 00051 return 0; 00052 } 00053 virtual bool uses_components() const { 00054 return false; 00055 } 00056 00057 virtual int get_length(int) const { 00058 return 2; 00059 } 00060 00061 virtual Geom *explode() const { 00062 return new GeomSphere(*this); 00063 } 00064 00065 public: 00066 static void register_with_read_factory(void); 00067 00068 static TypedWritable *make_GeomSphere(const FactoryParams ¶ms); 00069 00070 PUBLISHED: 00071 static TypeHandle get_class_type() { 00072 return _type_handle; 00073 } 00074 public: 00075 static void init_type() { 00076 Geom::init_type(); 00077 register_type(_type_handle, "GeomSphere", 00078 Geom::get_class_type()); 00079 } 00080 virtual TypeHandle get_type() const { 00081 return get_class_type(); 00082 } 00083 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00084 00085 private: 00086 static TypeHandle _type_handle; 00087 }; 00088 00089 #endif