31 GeomLines(GeomLines::UsageHint usage_hint) :
68 GeomPrimitive::PrimitiveType GeomLines::
69 get_primitive_type()
const {
78 make_adjacency()
const {
83 int num_vertices = from.get_num_vertices();
86 new_vertices->set_num_rows(num_vertices * 2);
91 map<int, int> forward_map, reverse_map;
92 for (
int i = 0; i < num_vertices; i += 2) {
93 int v0 = from.get_vertex(i);
94 int v1 = from.get_vertex(i + 1);
103 for (
int i = 0; i < num_vertices; i += 2) {
104 int v0 = from.get_vertex(i);
105 int v1 = from.get_vertex(i + 1);
107 auto it = reverse_map.find(v0);
108 if (it != reverse_map.end()) {
109 to.set_data1i(it->second);
119 it = forward_map.find(v1);
120 if (it != forward_map.end()) {
121 to.set_data1i(it->second);
127 nassertr(to.is_at_end(),
nullptr);
130 adj->set_vertices(std::move(new_vertices));
142 get_num_vertices_per_primitive()
const {
151 get_min_num_vertices_per_primitive()
const {
161 return gsg->draw_lines(reader, force);
168 rotate_impl()
const {
173 new_vertices->set_num_rows(num_vertices);
180 for (
int begin = 0; begin < num_vertices; begin += 2) {
181 from.set_row_unsafe(begin + 1);
182 to.set_data1i(from.get_data1i());
183 from.set_row_unsafe(begin);
184 to.set_data1i(from.get_data1i());
187 nassertr(to.is_at_end(),
nullptr);
194 for (
int begin = 0; begin < num_vertices; begin += 2) {
195 to.set_data1i(begin + 1 + first_vertex);
196 to.set_data1i(begin + first_vertex);
199 nassertr(to.is_at_end(),
nullptr);
209 register_with_read_factory() {
225 object->fillin(scan, manager);
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
Defines a series of disconnected line segments with adjacency information, for use with geometry shad...
get_usage_hint
Returns the usage hint for this primitive.
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...
PT(GeomPrimitive) GeomLines
Returns the fundamental rendering type of this primitive: whether it is points, lines,...
get_num_vertices
Returns the number of indices used by all the primitives in this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
Defines a series of disconnected line segments.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the data for one array of a GeomVertexData structure.