51 get_geom(Geom::UsageHint usage_hint)
const {
52 if (_geom.is_null()) {
56 if (_geom.is_null()) {
71 new_geom->set_usage_hint(usage_hint);
73 nassertr(vdata !=
nullptr, new_geom);
75 new_geom->modify_vertex_data()->set_usage_hint(usage_hint);
87 calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point,
88 bool &found_any,
Thread *current_thread)
const {
91 min_point.set(_quad_dimensions[0], 0, _quad_dimensions[1]);
92 max_point.set(_quad_dimensions[2], 0, _quad_dimensions[3]);
94 }
else if (!_geom.is_null()) {
95 _geom->calc_tight_bounds(min_point, max_point, found_any, current_thread);
104 set_quad(
const LVecBase4 &dimensions,
const LVecBase4 &texcoords,
108 _quad_dimensions = dimensions;
109 _quad_texcoords = texcoords;
122 geom->add_primitive(prim);
141 if (vdata->get_num_rows() != 4) {
146 if (_geom->get_num_primitives() != 1) {
150 if (!prim->is_indexed() ||
151 prim->get_primitive_type() != GeomPrimitive::PT_polygons) {
154 if (!prim->is_of_type(GeomTriangles::get_class_type())) {
155 prim = prim->decompose();
157 if (prim->get_num_vertices() != 6) {
163 if (format->get_num_columns() > 2 ||
164 !format->has_column(InternalName::get_vertex())) {
167 if (format->has_column(InternalName::get_texcoord()) != (format->get_num_columns() == 2)) {
175 LVecBase3 v = vertex.get_data3();
176 if (!IS_NEARLY_ZERO(v[1])) {
180 if (texcoord.has_column()) {
181 uv = texcoord.get_data2();
183 PN_stdfloat minx = v[0];
184 PN_stdfloat maxx = v[0];
185 PN_stdfloat miny = v[2];
186 PN_stdfloat maxy = v[2];
187 PN_stdfloat minu = uv[0];
188 PN_stdfloat maxu = uv[0];
189 PN_stdfloat minv = uv[1];
190 PN_stdfloat maxv = uv[1];
192 for (
int i = 1; i < 4; ++i) {
193 v = vertex.get_data3();
194 if (!IS_NEARLY_ZERO(v[1])) {
197 if (texcoord.has_column()) {
198 uv = texcoord.get_data2();
200 if (!IS_NEARLY_EQUAL(v[0], minx) && !IS_NEARLY_EQUAL(v[0], maxx)) {
201 if (!IS_NEARLY_EQUAL(minx, maxx)) {
213 if (!IS_NEARLY_EQUAL(v[2], miny) && !IS_NEARLY_EQUAL(v[2], maxy)) {
214 if (!IS_NEARLY_EQUAL(miny, maxy)) {
226 if (!IS_NEARLY_EQUAL(uv[0], minu) && !IS_NEARLY_EQUAL(uv[0], maxu)) {
229 if (!IS_NEARLY_EQUAL(uv[1], minv) && !IS_NEARLY_EQUAL(uv[1], maxv)) {
234 _quad_dimensions.set(minx, miny, maxx, maxy);
235 _quad_texcoords.set(minu, minv, maxu, maxv);
246 LVecBase4 dimensions, uvs;
256 vdata->unclean_set_num_rows(4);
265 indices->unclean_set_num_rows(6);
269 vertex.set_data3(dimensions[0], 0, dimensions[3]);
270 vertex.set_data3(dimensions[0], 0, dimensions[1]);
271 vertex.set_data3(dimensions[2], 0, dimensions[3]);
272 vertex.set_data3(dimensions[2], 0, dimensions[1]);
274 texcoord.set_data2(uvs[0], uvs[3]);
275 texcoord.set_data2(uvs[0], uvs[1]);
276 texcoord.set_data2(uvs[2], uvs[3]);
277 texcoord.set_data2(uvs[2], uvs[1]);
291 geom->add_primitive(tris);
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
This is a specialization on Geom for containing a primitive intended to represent a TextGlyph.
Defines a series of disconnected triangles.
This is the data for one array of a GeomVertexData structure.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
get_usage_hint
Returns the usage hint that was passed to the constructor, and which will be passed to each array dat...
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
A container for geometry primitives.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
A representation of a single glyph (character) from a font.
void set_geom(GeomVertexData *vdata, GeomPrimitive *prim, const RenderState *state)
Sets the geom from a pre-built Geom object.
virtual bool is_whitespace() const
Returns true if this glyph represents invisible whitespace, or false if it corresponds to some visibl...
bool get_quad(LVecBase4 &dimensions, LVecBase4 &texcoords) const
Assuming that this glyph is representable as a textured quad, returns its dimensions and UV range.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
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.
PT(Geom) TextGlyph
Returns a Geom that renders the particular glyph.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.