00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef EGGCOMPOSITEPRIMITIVE_H
00016 #define EGGCOMPOSITEPRIMITIVE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "eggPrimitive.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029 class EXPCL_PANDAEGG EggCompositePrimitive : public EggPrimitive {
00030 PUBLISHED:
00031 INLINE EggCompositePrimitive(const string &name = "");
00032 INLINE EggCompositePrimitive(const EggCompositePrimitive ©);
00033 INLINE EggCompositePrimitive &operator = (const EggCompositePrimitive ©);
00034 virtual ~EggCompositePrimitive();
00035
00036 virtual Shading get_shading() const;
00037
00038 INLINE int get_num_components() const;
00039 INLINE const EggAttributes *get_component(int i) const;
00040 INLINE EggAttributes *get_component(int i);
00041 MAKE_SEQ(get_components, get_num_components, get_component);
00042 INLINE void set_component(int i, const EggAttributes *attrib);
00043
00044 INLINE bool triangulate_into(EggGroupNode *container) const;
00045 PT(EggCompositePrimitive) triangulate_in_place();
00046
00047 virtual void unify_attributes(Shading shading);
00048 virtual void apply_last_attribute();
00049 virtual void apply_first_attribute();
00050 virtual void post_apply_flat_attribute();
00051 virtual bool cleanup();
00052
00053 protected:
00054 virtual int get_num_lead_vertices() const=0;
00055 virtual void prepare_add_vertex(EggVertex *vertex, int i, int n);
00056 virtual void prepare_remove_vertex(EggVertex *vertex, int i, int n);
00057
00058 virtual bool do_triangulate(EggGroupNode *container) const;
00059
00060 void write_body(ostream &out, int indent_level) const;
00061
00062 private:
00063 typedef pvector<EggAttributes *> Components;
00064 Components _components;
00065
00066 public:
00067
00068 static TypeHandle get_class_type() {
00069 return _type_handle;
00070 }
00071 static void init_type() {
00072 EggPrimitive::init_type();
00073 register_type(_type_handle, "EggCompositePrimitive",
00074 EggPrimitive::get_class_type());
00075 }
00076 virtual TypeHandle get_type() const {
00077 return get_class_type();
00078 }
00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00080
00081 private:
00082 static TypeHandle _type_handle;
00083
00084 };
00085
00086 #include "eggCompositePrimitive.I"
00087
00088 #endif