31GeomLinestrips(GeomLinestrips::UsageHint usage_hint) :
57 return new GeomLinestrips(*
this);
81 return GR_line_strip | GR_indexed_other | GR_strip_cut_index;
83 return GR_line_strip | GR_indexed_other;
99 GeomPrimitivePipelineReader from(
this, current_thread);
100 int num_vertices = from.get_num_vertices();
103 const int num_unused = 1;
107 map<int, int> forward_map, reverse_map;
108 int vi = -num_unused;
110 while (li < (
int)ends.size()) {
114 nassertr(vi + 1 <= end,
nullptr);
118 forward_map[v0] = v1;
119 reverse_map[v1] = v0;
124 nassertr(vi == num_vertices,
nullptr);
130 while (li < (
int)ends.size()) {
134 nassertr(vi + 1 <= end,
nullptr);
138 auto it = reverse_map.find(v0);
139 if (it != reverse_map.end()) {
140 adj->add_vertex(it->second);
155 it = forward_map.find(v1);
156 if (it != forward_map.end()) {
157 adj->add_vertex(it->second);
162 adj->close_primitive();
165 nassertr(vi == num_vertices,
nullptr);
196 return gsg->draw_linestrips(reader, force);
210decompose_impl()
const {
217 int vi = -num_unused;
219 while (li < (
int)ends.size()) {
223 nassertr(vi + 1 <= end, lines);
229 lines->add_vertex(v0);
230 lines->add_vertex(v1);
232 lines->close_primitive();
248 PT(GeomVertexArrayData) new_vertices = make_index_data();
252 CPT(GeomVertexArrayData) vertices = get_vertices();
253 GeomVertexReader from(vertices, 0);
254 GeomVertexWriter to(new_vertices, 0);
257 CPTA_int::const_iterator ei;
258 for (ei = ends.begin(); ei != ends.end(); ++ei) {
260 for (
int vi = end - 1; vi >= begin; --vi) {
261 from.set_row_unsafe(vi);
262 to.set_data1i(from.get_data1i());
267 nassertr(to.is_at_end(),
nullptr);
272 GeomVertexWriter to(new_vertices, 0);
275 CPTA_int::const_iterator ei;
276 for (ei = ends.begin(); ei != ends.end(); ++ei) {
278 for (
int vi = end - 1; vi >= begin; --vi) {
279 to.set_data1i(vi + first_vertex);
284 nassertr(to.is_at_end(),
nullptr);
294requires_unused_vertices()
const {
306 GeomVertexWriter to(vertices, 0);
331 object->fillin(scan, manager);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
A class to retrieve the individual data elements previously stored in a Datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
Defines a series of disconnected line segments.
Defines a series of line strips with adjacency information.
Defines a series of line strips.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
virtual PrimitiveType get_primitive_type() const
Returns the fundamental rendering type of this primitive: whether it is points, lines,...
virtual bool draw(GraphicsStateGuardianBase *gsg, const GeomPrimitivePipelineReader *reader, bool force) const
Calls the appropriate method on the GSG to draw the primitive.
virtual int get_min_num_vertices_per_primitive() const
Returns the minimum number of vertices that must be added before close_primitive() may legally be cal...
ConstPointerTo< GeomPrimitive > make_adjacency() const
Adds adjacency information to this primitive.
virtual int get_geom_rendering() const
Returns the set of GeomRendering bits that represent the rendering properties required to properly re...
virtual int get_num_unused_vertices_per_primitive() const
Returns the number of vertices that are added between primitives that aren't, strictly speaking,...
int get_vertex(int i) const
Returns the ith vertex index in the table.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
int get_num_primitives() const
Returns the number of individual primitives stored within this object.
CPTA_int get_ends() const
Returns a const pointer to the primitive ends array so application code can read it directly.
get_vertex
Returns the ith vertex index in the table.
get_usage_hint
Returns the usage hint for this primitive.
get_num_vertices
Returns the number of indices used by all the primitives in this object.
get_strip_cut_index
Returns the index of the indicated type that is reserved for use as a strip cut index,...
int get_first_vertex() const
Returns the first vertex number referenced by the primitive.
get_shade_model
Returns the ShadeModel hint for this primitive.
bool is_indexed() const
Returns true if the primitive is indexed, false otherwise.
This is the data for one array of a GeomVertexData structure.
int get_num_rows() const
Returns the number of rows stored in the array, based on the number of bytes and the stride.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
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.