15 #include "geomTristrips.h" 16 #include "geomTriangles.h" 17 #include "geomVertexRewriter.h" 18 #include "pStatTimer.h" 19 #include "bamReader.h" 20 #include "bamWriter.h" 21 #include "graphicsStateGuardianBase.h" 31 GeomTristrips(GeomTristrips::UsageHint usage_hint) :
77 GeomPrimitive::PrimitiveType GeomTristrips::
78 get_primitive_type()
const {
92 return GR_triangle_strip | GR_indexed_other;
94 return GR_triangle_strip;
132 return gsg->draw_tristrips(reader, force);
150 decompose_impl()
const {
165 int vi = -num_unused;
167 while (li < (
int)ends.size()) {
171 nassertr(vi + 2 <= end, NULL);
176 bool reversed =
false;
181 if (v0 != v1 && v0 != v2 && v1 != v2) {
182 triangles->add_vertex(v0);
183 triangles->add_vertex(v2);
184 triangles->add_vertex(v1);
185 triangles->close_primitive();
189 if (v0 != v1 && v0 != v2 && v1 != v2) {
190 triangles->add_vertex(v0);
191 triangles->add_vertex(v1);
192 triangles->add_vertex(v2);
193 triangles->close_primitive();
202 nassertr(vi == num_vertices, NULL);
207 int vi = -num_unused;
209 while (li < (
int)ends.size()) {
213 nassertr(vi + 2 <= end, NULL);
218 bool reversed =
false;
222 if (v0 != v1 && v0 != v2 && v1 != v2) {
223 triangles->add_vertex(v1);
224 triangles->add_vertex(v0);
225 triangles->add_vertex(v2);
226 triangles->close_primitive();
230 if (v0 != v1 && v0 != v2 && v1 != v2) {
231 triangles->add_vertex(v0);
232 triangles->add_vertex(v1);
233 triangles->add_vertex(v2);
234 triangles->close_primitive();
244 nassertr(vi == num_vertices, NULL);
247 return triangles.p();
256 doubleside_impl()
const {
259 return decompose_impl()->doubleside();
268 reverse_impl()
const {
271 return decompose_impl()->reverse();
280 rotate_impl()
const {
298 CPTA_int::const_iterator ei;
299 for (ei = ends.begin(); ei != ends.end(); ++ei) {
301 int num_vertices = end - begin;
305 to.set_data1i(last_added);
306 from.set_row_unsafe(end - 1);
307 to.set_data1i(from.get_data1i());
313 nassertr((num_vertices & 1) == 0, NULL);
314 for (
int vi = end - 1; vi >= begin; --vi) {
315 from.set_row_unsafe(vi);
316 last_added = from.get_data1i();
317 to.set_data1i(last_added);
323 nassertr(to.is_at_end(), NULL);
332 CPTA_int::const_iterator ei;
333 for (ei = ends.begin(); ei != ends.end(); ++ei) {
335 int num_vertices = end - begin;
339 to.set_data1i(last_added);
340 to.set_data1i(end - 1 + first_vertex);
346 nassertr((num_vertices & 1) == 0, NULL);
347 for (
int vi = end - 1; vi >= begin; --vi) {
348 last_added = vi + first_vertex;
349 to.set_data1i(last_added);
355 nassertr(to.is_at_end(), NULL);
367 requires_unused_vertices()
const {
384 int prev = from.get_data1i();
390 to.add_data1i(vertex);
418 parse_params(params, scan, manager);
419 object->fillin(scan, manager);
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
ShadeModel get_shade_model() const
Returns the ShadeModel hint for this primitive.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
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...
int get_num_vertices() const
Returns the number of indices used by all the primitives in this object.
virtual int get_geom_rendering() const
Returns the set of GeomRendering bits that represent the rendering properties required to properly re...
Defines a series of triangle strips.
int get_first_vertex() const
Returns the first vertex number referenced by the primitive.
virtual int get_num_unused_vertices_per_primitive() const
Returns the number of vertices that are added between primitives that aren't, strictly speaking...
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...
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)
Registers a new kind of thing the Factory will be able to create.
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_vertex(int i) const
Returns the ith vertex index in the table.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
UsageHint get_usage_hint() const
Returns the usage hint for this primitive.
Defines a series of disconnected triangles.
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.
bool is_indexed() const
Returns true if the primitive is indexed, false otherwise.
Similar to PointerToArray, except that its contents may not be modified.
This is the data for one array of a GeomVertexData structure.