15 #include "geomLinestrips.h"
16 #include "geomLines.h"
17 #include "geomVertexRewriter.h"
18 #include "pStatTimer.h"
19 #include "bamReader.h"
20 #include "bamWriter.h"
21 #include "graphicsStateGuardianBase.h"
31 GeomLinestrips(GeomLinestrips::UsageHint usage_hint) :
77 GeomPrimitive::PrimitiveType GeomLinestrips::
78 get_primitive_type()
const {
93 return GR_line_strip | GR_indexed_other | GR_strip_cut_index;
95 return GR_line_strip | GR_indexed_other;
136 return gsg->draw_linestrips(reader, force);
154 decompose_impl()
const {
159 int num_unused = get_num_unused_vertices_per_primitive();
161 int vi = -num_unused;
163 while (li < (
int)ends.size()) {
167 nassertr(vi + 1 <= end, lines.p());
168 int v0 = get_vertex(vi);
171 int v1 = get_vertex(vi);
173 lines->add_vertex(v0);
174 lines->add_vertex(v1);
176 lines->close_primitive();
180 nassertr(vi == get_num_vertices(), NULL);
191 rotate_impl()
const {
195 new_vertices->set_num_rows(get_num_vertices());
204 for (ei = ends.begin(); ei != ends.end(); ++ei) {
206 for (
int vi = end - 1; vi >= begin; --vi) {
207 from.set_row_unsafe(vi);
217 int first_vertex = get_first_vertex();
221 CPTA_int::const_iterator ei;
222 for (ei = ends.begin(); ei != ends.end(); ++ei) {
224 for (
int vi = end - 1; vi >= begin; --vi) {
241 bool GeomLinestrips::
242 requires_unused_vertices()
const {
255 void GeomLinestrips::
287 parse_params(params, scan, manager);
288 object->fillin(scan, manager);
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
bool is_indexed() const
Returns true if the primitive is indexed, false otherwise.
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 the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void add_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row. ...
int get_strip_cut_index() const
If relevant, returns the index value that may be used in some cases to signify the end of a primitive...
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...
void set_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row. ...
virtual int get_geom_rendering() const
Returns the set of GeomRendering bits that represent the rendering properties required to properly re...
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...
ShadeModel get_shade_model() const
Returns the shade model common to all of the individual GeomPrimitives that have been added to the ge...
UsageHint get_usage_hint() const
Returns the minimum (i.e.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual Geom * make_copy() const
Returns a newly-allocated Geom that is a shallow copy of this one.
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
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...
virtual int get_num_unused_vertices_per_primitive() const
Returns the number of vertices that are added between primitives that aren't, strictly speaking...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
Defines a series of line strips.
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. ...
TypeHandle is the identifier used to differentiate C++ class types.
Encapsulates the data from a GeomPrimitive, pre-fetched for one stage of the pipeline.
int get_num_primitives() const
Returns the number of individual primitives stored within this object.
Similar to PointerToArray, except that its contents may not be modified.
This is the data for one array of a GeomVertexData structure.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
bool is_at_end() const
Returns true if the writer is currently at the end of the list of vertices, false otherwise...