Panda3D
geomPatches.h
1 // Filename: geomPatches.h
2 // Created by: drose (27Apr12)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef GEOMPATCHES_H
16 #define GEOMPATCHES_H
17 
18 #include "pandabase.h"
19 #include "geomPrimitive.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : GeomPatches
23 // Description : Defines a series of "patches", fixed-size groupings
24 // of vertices that must be processed by a tessellation
25 // shader.
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDA_GOBJ GeomPatches : public GeomPrimitive {
28 PUBLISHED:
29  GeomPatches(int num_vertices_per_patch, UsageHint usage_hint);
30  GeomPatches(const GeomPatches &copy);
31  virtual ~GeomPatches();
32  ALLOC_DELETED_CHAIN(GeomPatches);
33 
34 public:
35  virtual PT(GeomPrimitive) make_copy() const;
36  virtual PrimitiveType get_primitive_type() const;
37 
38  virtual int get_num_vertices_per_primitive() const;
39 
40 public:
41  virtual bool draw(GraphicsStateGuardianBase *gsg,
42  const GeomPrimitivePipelineReader *reader,
43  bool force) const;
44 
45 private:
46  int _num_vertices_per_patch;
47 
48 public:
49  static void register_with_read_factory();
50  virtual void write_datagram(BamWriter *manager, Datagram &dg);
51 
52 protected:
53  void fillin(DatagramIterator &scan, BamReader *manager);
54  static TypedWritable *make_from_bam(const FactoryParams &params);
55 
56 public:
57  static TypeHandle get_class_type() {
58  return _type_handle;
59  }
60  static void init_type() {
61  GeomPrimitive::init_type();
62  register_type(_type_handle, "GeomPatches",
63  GeomPrimitive::get_class_type());
64  }
65  virtual TypeHandle get_type() const {
66  return get_class_type();
67  }
68  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69 
70 private:
71  static TypeHandle _type_handle;
72 
73  friend class Geom;
74 };
75 
76 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition: geomPrimitive.h:63
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
Defines a series of "patches", fixed-size groupings of vertices that must be processed by a tessellat...
Definition: geomPatches.h:27
A container for geometry primitives.
Definition: geom.h:58
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
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...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Encapsulates the data from a GeomPrimitive, pre-fetched for one stage of the pipeline.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43