Panda3D
Loading...
Searching...
No Matches
meshDrawer2D.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file meshDrawer2D.h
10 * @author treeform
11 * @date 2010-01-06
12 */
13
14#ifndef MESHDRAWER2D_H
15#define MESHDRAWER2D_H
16
17#include "pandabase.h"
18#include "luse.h"
19#include "pandaNode.h"
20#include "pointerTo.h"
21#include "lpoint2.h"
22#include "lvecBase2.h"
23#include "pnmImage.h"
24#include "nodePath.h"
25#include "texture.h"
26#include "geomVertexFormat.h"
28#include "geomVertexData.h"
29#include "geomVertexWriter.h"
30#include "geomVertexRewriter.h"
31#include "boundingVolume.h"
32
33#include "nodePathCollection.h"
34
35#include "geomTristrips.h"
36#include "geomTriangles.h"
37#include "geom.h"
38#include "geomNode.h"
39#include "nodePath.h"
40
41/**
42 * This class allows the drawing of 2D objects - mainly based on quads and
43 * rectangles. It allows clipping and several high level UI theme functions.
44 */
45class EXPCL_PANDA_GRUTIL MeshDrawer2D : public TypedObject {
46PUBLISHED:
47 INLINE MeshDrawer2D();
48 INLINE ~MeshDrawer2D();
49
50 INLINE void set_budget(int budget);
51 INLINE int get_budget();
52 INLINE NodePath get_root();
53
54 INLINE void quad_raw(
55 const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
56 const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2,
57 const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3,
58 const LVector3 &v4, const LVector4 &c4, const LVector2 &uv4);
59
60 INLINE void rectangle_raw(
61 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
62 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
63 const LVector4 &color);
64
65 INLINE void set_clip(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h);
66
67 INLINE void rectangle(
68 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
69 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
70 const LVector4 &color);
71
72 void rectangle_border(
73 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
74 PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
75 PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
76 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
77 const LVector4 &color);
78
79 void rectangle_border_tiled(
80 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
81 PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
82 PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
83 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
84 const LVector4 &color);
85
86 void rectangle_tiled(
87 PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
88 PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
89 const LVector4 &color);
90
91 void begin();
92 void end();
93
94private:
95
96 // use vars
97 NodePath _root;
98 int _budget;
99
100 // clip
101 PN_stdfloat _clip_x;
102 PN_stdfloat _clip_y;
103 PN_stdfloat _clip_w;
104 PN_stdfloat _clip_h;
105
106 // store regeneration geoms & nodes
107 PT(Geom) _geom;
108 PT(GeomNode) _geomnode;
109 PT(GeomVertexData) _vdata;
110 PT(GeomTriangles) _prim;
111 CPT(GeomPrimitive) _dprim;
112
113 // writers
114 GeomVertexRewriter *_vertex;
116 GeomVertexRewriter *_color;
117
118 // clear indexes
119 int _last_clear_index, _start_clear_index, _end_clear_index, _clear_index;
120
121 // bounding volume
122 PT(BoundingVolume) _bv;
123
124 // private create all the needed geoms
125 void generator(int budget);
126
127public:
128 static TypeHandle get_class_type() {
129 return _type_handle;
130 }
131 static void init_type() {
133 register_type(_type_handle, "MeshDrawer2D",
134 TypedObject::get_class_type());
135 }
136 virtual TypeHandle get_type() const {
137 return get_class_type();
138 }
139 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
140
141private:
142 static TypeHandle _type_handle;
143
144};
145
146#include "meshDrawer2D.I"
147
148#endif /*MESHDRAWER2D_H*/
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
A node that holds Geom objects, renderable pieces of geometry.
Definition geomNode.h:34
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Defines a series of disconnected triangles.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter,...
A container for geometry primitives.
Definition geom.h:54
This class allows the drawing of 2D objects - mainly based on quads and rectangles.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition typedObject.h:88
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.