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);
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
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...
get_vertex
Returns the ith vertex index in the table.
UsageHint get_usage_hint() const
Returns the minimum (i.e.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
get_num_vertices
Returns the number of indices used by all the primitives in 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,...
int get_first_vertex() const
Returns the first vertex number referenced by the 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,...
get_current_thread
Returns a pointer to the currently-executing Thread object.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
CPTA_int get_ends() const
Returns a const pointer to the primitive ends array so application code can read it directly.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_strip_cut_index
Returns the index of the indicated type that is reserved for use as a strip cut index,...
Defines a series of disconnected line segments.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
int get_num_rows() const
Returns the number of rows stored in the array, based on the number of bytes and the stride.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
int get_num_primitives() const
Returns the number of individual primitives stored within this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
Defines a series of line strips.
get_shade_model
Returns the ShadeModel hint for this primitive.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
A class to retrieve the individual data elements previously stored in a Datagram.
Defines a series of line strips with adjacency information.
TypeHandle is the identifier used to differentiate C++ class types.
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.
Similar to PointerToArray, except that its contents may not be modified.
This is the data for one array of a GeomVertexData structure.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.