Go to the documentation of this file.
31 GeomLinestrips(GeomLinestrips::UsageHint usage_hint) :
68 GeomPrimitive::PrimitiveType GeomLinestrips::
69 get_primitive_type()
const {
78 get_geom_rendering()
const {
81 return GR_line_strip | GR_indexed_other | GR_strip_cut_index;
83 return GR_line_strip | GR_indexed_other;
95 make_adjacency()
const {
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);
115 int v0 = from.get_vertex(vi++);
117 int v1 = from.get_vertex(vi++);
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);
137 int v0 = from.get_vertex(vi++);
138 auto it = reverse_map.find(v0);
139 if (it != reverse_map.end()) {
140 adj->add_vertex(it->second);
150 v1 = from.get_vertex(vi++);
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);
175 get_min_num_vertices_per_primitive()
const {
186 get_num_unused_vertices_per_primitive()
const {
193 bool GeomLinestrips::
196 return gsg->draw_linestrips(reader, force);
210 decompose_impl()
const {
215 int num_unused = get_num_unused_vertices_per_primitive();
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();
245 rotate_impl()
const {
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);
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);
293 bool GeomLinestrips::
294 requires_unused_vertices()
const {
304 void GeomLinestrips::
331 object->fillin(scan, manager);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the data for one array of a GeomVertexData structure.
int get_first_vertex() const
Returns the first vertex number referenced by the primitive.
A class to retrieve the individual data elements previously stored in a Datagram.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
get_strip_cut_index
Returns the index of the indicated type that is reserved for use as a strip cut index,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
Similar to PointerToArray, except that its contents may not be modified.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a series of line strips.
get_vertex
Returns the ith vertex index in the table.
Base class for objects that can be written to and read from Bam files.
Defines a series of line strips with adjacency information.
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
int get_num_rows() const
Returns the number of rows stored in the array, based on the number of bytes and the stride.
get_num_vertices
Returns the number of indices used by all the primitives in this object.
int get_num_primitives() const
Returns the number of individual primitives stored within this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PT(GeomPrimitive) GeomLinestrips
Returns the fundamental rendering type of this primitive: whether it is points, lines,...
get_shade_model
Returns the ShadeModel hint for this primitive.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
CPTA_int get_ends() const
Returns a const pointer to the primitive ends array so application code can read it directly.
Encapsulates the data from a GeomPrimitive, pre-fetched for one stage of the pipeline.
bool is_indexed() const
Returns true if the primitive is indexed, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
get_usage_hint
Returns the usage hint for this primitive.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
This is an abstract base class for a family of classes that represent the fundamental geometry primit...