00001 // Filename: geomLine.h 00002 // Created by: charles (13Jul00) 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 GEOMLINE_H 00020 #define GEOMLINE_H 00021 00022 #include "geom.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : GeomLine 00026 // Description : Line Primitive 00027 //////////////////////////////////////////////////////////////////// 00028 class EXPCL_PANDA GeomLine : public Geom 00029 { 00030 public: 00031 GeomLine( void ) : Geom() { _width = 1.0f; } 00032 virtual Geom *make_copy() const; 00033 virtual void print_draw_immediate( void ) const { } 00034 virtual void draw_immediate(GraphicsStateGuardianBase *gsg, GeomContext *gc); 00035 00036 virtual int get_num_vertices_per_prim() const { 00037 return 2; 00038 } 00039 virtual int get_num_more_vertices_than_components() const { 00040 return 0; 00041 } 00042 virtual bool uses_components() const { 00043 return false; 00044 } 00045 00046 virtual int get_length(int) const { 00047 return 2; 00048 } 00049 00050 virtual Geom *explode() const { 00051 return new GeomLine(*this); 00052 } 00053 00054 INLINE void set_width(float width) { _width = width; } 00055 INLINE float get_width(void) const { return _width; } 00056 00057 protected: 00058 float _width; 00059 00060 public: 00061 static void register_with_read_factory(void); 00062 virtual void write_datagram(BamWriter* manager, Datagram &me); 00063 00064 static TypedWritable *make_GeomLine(const FactoryParams ¶ms); 00065 00066 protected: 00067 void fillin(DatagramIterator& scan, BamReader* manager); 00068 00069 PUBLISHED: 00070 static TypeHandle get_class_type() { 00071 return _type_handle; 00072 } 00073 public: 00074 static void init_type() { 00075 Geom::init_type(); 00076 register_type(_type_handle, "GeomLine", 00077 Geom::get_class_type()); 00078 } 00079 virtual TypeHandle get_type() const { 00080 return get_class_type(); 00081 } 00082 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00083 00084 private: 00085 static TypeHandle _type_handle; 00086 }; 00087 00088 #endif