00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MESHDRAWER2D_H
00016 #define MESHDRAWER2D_H
00017
00018 #include "pandabase.h"
00019 #include "luse.h"
00020 #include "pandaNode.h"
00021 #include "pointerTo.h"
00022 #include "lpoint2.h"
00023 #include "lvecBase2.h"
00024 #include "pnmImage.h"
00025 #include "nodePath.h"
00026 #include "texture.h"
00027 #include "geomVertexFormat.h"
00028 #include "geomVertexArrayFormat.h"
00029 #include "geomVertexData.h"
00030 #include "geomVertexWriter.h"
00031 #include "geomVertexRewriter.h"
00032 #include "boundingVolume.h"
00033
00034 #include "nodePathCollection.h"
00035
00036 #include "geomTristrips.h"
00037 #include "geomTriangles.h"
00038 #include "geom.h"
00039 #include "geomNode.h"
00040 #include "nodePath.h"
00041
00042
00043
00044
00045
00046
00047
00048
00049 class EXPCL_PANDA_GRUTIL MeshDrawer2D : public TypedObject {
00050 PUBLISHED:
00051 INLINE MeshDrawer2D();
00052 INLINE ~MeshDrawer2D();
00053
00054 INLINE void set_budget(int budget);
00055 INLINE int get_budget();
00056 INLINE NodePath get_root();
00057
00058 INLINE void quad_raw(
00059 const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
00060 const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2,
00061 const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3,
00062 const LVector3 &v4, const LVector4 &c4, const LVector2 &uv4);
00063
00064 INLINE void rectangle_raw(
00065 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
00066 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
00067 const LVector4 &color);
00068
00069 INLINE void set_clip(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h);
00070
00071 INLINE void rectangle(
00072 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
00073 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
00074 const LVector4 &color);
00075
00076 void rectangle_border(
00077 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
00078 PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
00079 PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
00080 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
00081 const LVector4 &color);
00082
00083 void rectangle_border_tiled(
00084 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
00085 PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
00086 PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
00087 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
00088 const LVector4 &color);
00089
00090 void rectangle_tiled(
00091 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
00092 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
00093 const LVector4 &color);
00094
00095 void begin();
00096 void end();
00097
00098 private:
00099
00100
00101 NodePath _root;
00102 int _budget;
00103
00104
00105 PN_stdfloat _clip_x;
00106 PN_stdfloat _clip_y;
00107 PN_stdfloat _clip_w;
00108 PN_stdfloat _clip_h;
00109
00110
00111 PT(Geom) _geom;
00112 PT(GeomNode) _geomnode;
00113 PT(GeomVertexData) _vdata;
00114 PT(GeomTriangles) _prim;
00115 CPT(GeomPrimitive) _dprim;
00116
00117
00118 GeomVertexRewriter *_vertex;
00119 GeomVertexRewriter *_uv;
00120 GeomVertexRewriter *_color;
00121
00122
00123 int _last_clear_index, _start_clear_index, _end_clear_index, _clear_index;
00124
00125
00126 PT(BoundingVolume) _bv;
00127
00128
00129 void generator(int budget);
00130
00131 public:
00132 static TypeHandle get_class_type() {
00133 return _type_handle;
00134 }
00135 static void init_type() {
00136 TypedObject::init_type();
00137 register_type(_type_handle, "MeshDrawer2D",
00138 TypedObject::get_class_type());
00139 }
00140 virtual TypeHandle get_type() const {
00141 return get_class_type();
00142 }
00143 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00144
00145 private:
00146 static TypeHandle _type_handle;
00147
00148 };
00149
00150 #include "meshDrawer2D.I"
00151
00152 #endif