30 GeomTriangles(GeomTriangles::UsageHint usage_hint) :
    67 GeomPrimitive::PrimitiveType GeomTriangles::
    68 get_primitive_type()
 const {
    77 make_adjacency()
 const {
    84   int num_vertices = from.get_num_vertices();
    87   new_vertices->set_num_rows(num_vertices * 2);
    90   map<std::pair<int, int>, 
int> edge_map;
    91   for (
int i = 0; i < num_vertices; i += 3) {
    92     int v0 = from.get_vertex(i);
    93     int v1 = from.get_vertex(i + 1);
    94     int v2 = from.get_vertex(i + 2);
    95     edge_map[make_pair(v0, v1)] = v2;
    96     edge_map[make_pair(v1, v2)] = v0;
    97     edge_map[make_pair(v2, v0)] = v1;
   104     for (
int i = 0; i < num_vertices; i += 3) {
   105       int v0 = from.get_vertex(i);
   106       int v1 = from.get_vertex(i + 1);
   107       int v2 = from.get_vertex(i + 2);
   111       auto it = edge_map.find(make_pair(v1, v0));
   112       if (it != edge_map.end()) {
   113         to.set_data1i(it->second);
   121       it = edge_map.find(make_pair(v2, v1));
   122       if (it != edge_map.end()) {
   123         to.set_data1i(it->second);
   129       it = edge_map.find(make_pair(v0, v2));
   130       if (it != edge_map.end()) {
   131         to.set_data1i(it->second);
   137     nassertr(to.is_at_end(), 
nullptr);
   140   adj->set_vertices(std::move(new_vertices));
   152 get_num_vertices_per_primitive()
 const {
   162   return gsg->draw_triangles(reader, force);
   169 doubleside_impl()
 const {
   180   bool needs_rotate = 
false;
   181   switch (from.get_shade_model()) {
   182   case SM_flat_first_vertex:
   183   case SM_flat_last_vertex:
   192   for (
int i = from.get_num_vertices() - 1; i >= 0; --i) {
   193     reversed->add_vertex(from.get_vertex(i));
   209 reverse_impl()
 const {
   214   reversed->clear_vertices();
   216   for (
int i = from.get_num_vertices() - 1; i >= 0; --i) {
   217     reversed->add_vertex(from.get_vertex(i));
   220   switch (from.get_shade_model()) {
   221   case SM_flat_first_vertex:
   222     reversed->set_shade_model(SM_flat_last_vertex);
   226   case SM_flat_last_vertex:
   227     reversed->set_shade_model(SM_flat_first_vertex);
   242 rotate_impl()
 const {
   249   new_vertices->set_num_rows(num_vertices);
   256     switch (shade_model) {
   257     case SM_flat_first_vertex:
   260         for (
int begin = 0; begin < num_vertices; begin += 3) {
   261           from.set_row_unsafe(begin + 1);
   262           to.set_data1i(from.get_data1i());
   263           to.set_data1i(from.get_data1i());
   264           from.set_row_unsafe(begin);
   265           to.set_data1i(from.get_data1i());
   270     case SM_flat_last_vertex:
   273         for (
int begin = 0; begin < num_vertices; begin += 3) {
   274           from.set_row_unsafe(begin + 2);
   275           to.set_data1i(from.get_data1i());
   276           from.set_row_unsafe(begin);
   277           to.set_data1i(from.get_data1i());
   278           to.set_data1i(from.get_data1i());
   285       nassertr(
false, vertices);
   288     nassertr(to.is_at_end(), 
nullptr);
   295     switch (shade_model) {
   296     case SM_flat_first_vertex:
   299         for (
int begin = 0; begin < num_vertices; begin += 3) {
   300           to.set_data1i(begin + 1 + first_vertex);
   301           to.set_data1i(begin + 2 + first_vertex);
   302           to.set_data1i(begin + first_vertex);
   307     case SM_flat_last_vertex:
   310         for (
int begin = 0; begin < num_vertices; begin += 3) {
   311           to.set_data1i(begin + 2 + first_vertex);
   312           to.set_data1i(begin + first_vertex);
   313           to.set_data1i(begin + 1 + first_vertex);
   320       nassertr(
false, 
nullptr);
   323     nassertr(to.is_at_end(), 
nullptr);
   333 register_with_read_factory() {
   349   object->fillin(scan, manager);
 This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
get_usage_hint
Returns the usage hint for this primitive.
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...
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.
Defines a series of disconnected triangles, with adjacency information.
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...
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.
PT(GeomPrimitive) GeomTriangles
Returns the fundamental rendering type of this primitive: whether it is points, lines,...
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...
get_shade_model
Returns the ShadeModel hint for this primitive.
Defines a series of disconnected triangles.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
This is the data for one array of a GeomVertexData structure.