15 #include "geomTriangles.h"
16 #include "geomVertexRewriter.h"
17 #include "pStatTimer.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
20 #include "graphicsStateGuardianBase.h"
30 GeomTriangles(GeomTriangles::UsageHint usage_hint) :
76 GeomPrimitive::PrimitiveType GeomTriangles::
77 get_primitive_type()
const {
106 return gsg->draw_triangles(reader, force);
115 doubleside_impl()
const {
127 bool needs_rotate = false;
128 switch (from.get_shade_model()) {
129 case SM_flat_first_vertex:
130 case SM_flat_last_vertex:
139 for (
int i = from.get_num_vertices() - 1; i >= 0; --i) {
158 reverse_impl()
const {
163 reversed->clear_vertices();
165 for (
int i = from.get_num_vertices() - 1; i >= 0; --i) {
169 switch (from.get_shade_model()) {
170 case SM_flat_first_vertex:
171 reversed->set_shade_model(SM_flat_last_vertex);
175 case SM_flat_last_vertex:
176 reversed->set_shade_model(SM_flat_first_vertex);
193 rotate_impl()
const {
197 ShadeModel shade_model = get_shade_model();
198 int num_vertices = get_num_vertices();
201 new_vertices->set_num_rows(num_vertices);
208 switch (shade_model) {
209 case SM_flat_first_vertex:
212 for (
int begin = 0; begin < num_vertices; begin += 3) {
213 from.set_row_unsafe(begin + 1);
216 from.set_row_unsafe(begin);
222 case SM_flat_last_vertex:
225 for (
int begin = 0; begin < num_vertices; begin += 3) {
226 from.set_row_unsafe(begin + 2);
228 from.set_row_unsafe(begin);
237 nassertr(
false, vertices);
244 int first_vertex = get_first_vertex();
247 switch (shade_model) {
248 case SM_flat_first_vertex:
251 for (
int begin = 0; begin < num_vertices; begin += 3) {
259 case SM_flat_last_vertex:
262 for (
int begin = 0; begin < num_vertices; begin += 3) {
272 nassertr(
false, NULL);
306 parse_params(params, scan, manager);
307 object->fillin(scan, manager);
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
virtual int get_num_vertices_per_primitive() const
If the primitive type is a simple type in which all primitives have the same number of vertices...
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...
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
void set_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row. ...
static Thread * 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...
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...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
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...
int get_vertex(int i) const
Returns the ith vertex index in the table.
Defines a series of disconnected triangles.
A class to retrieve the individual data elements previously stored in a Datagram. ...
virtual bool draw(GraphicsStateGuardianBase *gsg, const GeomPrimitivePipelineReader *reader, bool force) const
Calls the appropriate method on the GSG to draw the primitive.
TypeHandle is the identifier used to differentiate C++ class types.
Encapsulates the data from a GeomPrimitive, pre-fetched for one stage of the pipeline.
This is the data for one array of a GeomVertexData structure.
bool is_at_end() const
Returns true if the writer is currently at the end of the list of vertices, false otherwise...