14 #ifndef GEOMPRIMITIVE_H 15 #define GEOMPRIMITIVE_H 70 virtual PrimitiveType get_primitive_type()
const=0;
71 virtual int get_geom_rendering()
const;
72 MAKE_PROPERTY(primitive_type, get_primitive_type);
73 MAKE_PROPERTY(geom_rendering, get_geom_rendering);
75 INLINE ShadeModel get_shade_model()
const;
76 INLINE
void set_shade_model(ShadeModel shade_model);
77 MAKE_PROPERTY(shade_model, get_shade_model);
79 INLINE UsageHint get_usage_hint()
const;
80 void set_usage_hint(UsageHint usage_hint);
81 MAKE_PROPERTY(usage_hint, get_usage_hint);
83 INLINE NumericType get_index_type()
const;
84 void set_index_type(NumericType index_type);
85 MAKE_PROPERTY(index_type, get_index_type);
94 INLINE
bool is_composite()
const;
95 INLINE
bool is_indexed()
const;
96 INLINE
int get_first_vertex()
const;
97 INLINE
int get_num_vertices()
const;
98 INLINE
int get_vertex(
int i)
const;
99 MAKE_SEQ(get_vertex_list, get_num_vertices, get_vertex);
100 void add_vertex(
int vertex);
101 INLINE
void add_vertices(
int v1,
int v2);
102 INLINE
void add_vertices(
int v1,
int v2,
int v3);
103 INLINE
void add_vertices(
int v1,
int v2,
int v3,
int v4);
104 void add_consecutive_vertices(
int start,
int num_vertices);
105 void add_next_vertices(
int num_vertices);
106 void reserve_num_vertices(
int num_vertices);
107 bool close_primitive();
108 void clear_vertices();
109 void offset_vertices(
int offset);
110 void offset_vertices(
int offset,
int begin_row,
int end_row);
115 INLINE
int get_num_primitives()
const;
116 int get_primitive_start(
int n)
const;
117 int get_primitive_end(
int n)
const;
118 int get_primitive_num_vertices(
int n)
const;
119 int get_num_used_vertices()
const;
121 INLINE
int get_num_faces()
const;
122 INLINE
int get_primitive_num_faces(
int n)
const;
124 INLINE
int get_min_vertex()
const;
125 int get_primitive_min_vertex(
int n)
const;
126 INLINE
int get_max_vertex()
const;
127 int get_primitive_max_vertex(
int n)
const;
133 CPT(
GeomPrimitive) match_shade_model(ShadeModel shade_model)
const;
139 int get_num_bytes()
const;
140 INLINE
int get_data_size_bytes()
const;
142 MAKE_PROPERTY(num_bytes, get_num_bytes);
143 MAKE_PROPERTY(data_size_bytes, get_data_size_bytes);
144 MAKE_PROPERTY(modified, get_modified);
146 bool request_resident(
Thread *current_thread = Thread::get_current_thread())
const;
151 virtual void output(std::ostream &out)
const;
152 virtual void write(std::ostream &out,
int indent_level)
const;
171 void set_nonindexed_vertices(
int first_vertex,
int num_vertices);
173 INLINE
int get_index_stride()
const;
174 INLINE
int get_strip_cut_index()
const;
175 MAKE_PROPERTY(index_stride, get_index_stride);
176 MAKE_PROPERTY(strip_cut_index, get_strip_cut_index);
179 PTA_int modify_ends();
180 void set_ends(PTA_int ends);
184 MAKE_PROPERTY(mins, get_mins);
185 MAKE_PROPERTY(maxs, get_maxs);
187 void set_minmax(
int min_vertex,
int max_vertex,
191 virtual int get_num_vertices_per_primitive()
const;
192 virtual int get_min_num_vertices_per_primitive()
const;
193 virtual int get_num_unused_vertices_per_primitive()
const;
194 MAKE_PROPERTY(num_vertices_per_primitive, get_num_vertices_per_primitive);
195 MAKE_PROPERTY(min_num_vertices_per_primitive, get_min_num_vertices_per_primitive);
196 MAKE_PROPERTY(num_unused_vertices_per_primitive, get_num_unused_vertices_per_primitive);
215 static int get_highest_index_value(NumericType index_type);
216 static int get_strip_cut_index(NumericType index_type);
223 void calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point,
224 PN_stdfloat &sq_center_dist,
bool &found_any,
226 bool got_mat,
const LMatrix4 &mat,
228 Thread *current_thread)
const;
230 void calc_sphere_radius(
const LPoint3 ¢er,
231 PN_stdfloat &sq_radius,
bool &found_any,
233 Thread *current_thread)
const;
240 virtual bool requires_unused_vertices()
const;
247 void recompute_minmax(CData *cdata);
248 void do_make_indexed(CData *cdata);
249 void consider_elevate_index_type(CData *cdata,
int vertex);
250 void do_set_index_type(CData *cdata, NumericType index_type);
262 class EXPCL_PANDA_GOBJ CData :
public CycleData {
265 INLINE CData(
const CData ©);
266 ALLOC_DELETED_CHAIN(CData);
273 return GeomPrimitive::get_class_type();
276 ShadeModel _shade_model;
279 NumericType _index_type;
280 UsageHint _usage_hint;
288 unsigned int _min_vertex;
289 unsigned int _max_vertex;
295 static void init_type() {
329 static void init_type() {
330 CopyOnWriteObject::init_type();
332 CopyOnWriteObject::get_class_type());
336 return get_class_type();
338 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
363 INLINE
Thread *get_current_thread()
const;
365 void check_minmax()
const;
367 INLINE ShadeModel get_shade_model()
const;
368 INLINE UsageHint get_usage_hint()
const;
369 INLINE NumericType get_index_type()
const;
370 INLINE
bool is_indexed()
const;
371 int get_first_vertex()
const;
372 INLINE
int get_num_vertices()
const;
373 int get_vertex(
int i)
const;
374 int get_num_primitives()
const;
375 void get_referenced_vertices(
BitArray &bits)
const;
376 INLINE
int get_min_vertex()
const;
377 INLINE
int get_max_vertex()
const;
378 INLINE
int get_data_size_bytes()
const;
381 INLINE
int get_index_stride()
const;
382 INLINE
const unsigned char *get_read_pointer(
bool force)
const;
383 INLINE
int get_strip_cut_index()
const;
395 const GeomPrimitive::CData *_cdata;
398 const GeomVertexArrayData::CData *_vertices_cdata;
404 static void init_type() {
412 INLINE std::ostream &operator << (std::ostream &out,
const GeomPrimitive &obj);
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a special class object that holds all the information returned by a particular GSG to indicat...
This class is similar to CycleDataWriter, except it allows writing to a particular stage of the pipel...
A single page of data maintained by a PipelineCycler.
Base class for objects that can be written to and read from Bam files.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is our own Panda specialization on the default STL list.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A table of objects that are saved within the graphics context for reference by handle later.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
A dynamic array with an unlimited number of bits.
A lightweight class that represents a single element that may be timed and/or counted via stats.
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encodes a string name in a hash table, mapping it to a pointer.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
This base class provides basic reference counting, but also can be used with a CopyOnWritePointer to ...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
A class to retrieve the individual data elements previously stored in a Datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
This is a sequence number that increments monotonically.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Similar to PointerToArray, except that its contents may not be modified.
This is the data for one array of a GeomVertexData structure.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.