mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
copy constructors, other minor refinements
This commit is contained in:
parent
18dbe6527c
commit
4cc9dba771
@ -147,9 +147,9 @@ modify_primitive(int i) {
|
|||||||
// returning the result. See
|
// returning the result. See
|
||||||
// GeomPrimitive::decompose().
|
// GeomPrimitive::decompose().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE CPT(Geom) Geom::
|
INLINE PT(Geom) Geom::
|
||||||
decompose() const {
|
decompose() const {
|
||||||
PT(Geom) new_geom = new Geom(*this);
|
PT(Geom) new_geom = make_copy();
|
||||||
new_geom->decompose_in_place();
|
new_geom->decompose_in_place();
|
||||||
return new_geom;
|
return new_geom;
|
||||||
}
|
}
|
||||||
@ -161,9 +161,9 @@ decompose() const {
|
|||||||
// returning the result. See
|
// returning the result. See
|
||||||
// GeomPrimitive::rotate().
|
// GeomPrimitive::rotate().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE CPT(Geom) Geom::
|
INLINE PT(Geom) Geom::
|
||||||
rotate() const {
|
rotate() const {
|
||||||
PT(Geom) new_geom = new Geom(*this);
|
PT(Geom) new_geom = make_copy();
|
||||||
new_geom->rotate_in_place();
|
new_geom->rotate_in_place();
|
||||||
return new_geom;
|
return new_geom;
|
||||||
}
|
}
|
||||||
@ -177,9 +177,9 @@ rotate() const {
|
|||||||
// the Geom contains both triangle strips and triangle
|
// the Geom contains both triangle strips and triangle
|
||||||
// fans.
|
// fans.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE CPT(Geom) Geom::
|
INLINE PT(Geom) Geom::
|
||||||
unify() const {
|
unify() const {
|
||||||
PT(Geom) new_geom = new Geom(*this);
|
PT(Geom) new_geom = make_copy();
|
||||||
new_geom->unify_in_place();
|
new_geom->unify_in_place();
|
||||||
return new_geom;
|
return new_geom;
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,9 @@ PUBLISHED:
|
|||||||
void remove_primitive(int i);
|
void remove_primitive(int i);
|
||||||
void clear_primitives();
|
void clear_primitives();
|
||||||
|
|
||||||
INLINE CPT(Geom) decompose() const;
|
INLINE PT(Geom) decompose() const;
|
||||||
INLINE CPT(Geom) rotate() const;
|
INLINE PT(Geom) rotate() const;
|
||||||
INLINE CPT(Geom) unify() const;
|
INLINE PT(Geom) unify() const;
|
||||||
|
|
||||||
void decompose_in_place();
|
void decompose_in_place();
|
||||||
void rotate_in_place();
|
void rotate_in_place();
|
||||||
|
@ -161,21 +161,27 @@ decompose_impl() const {
|
|||||||
++vi;
|
++vi;
|
||||||
bool reversed = false;
|
bool reversed = false;
|
||||||
while (vi < end) {
|
while (vi < end) {
|
||||||
triangles->add_vertex(v0);
|
|
||||||
int v2 = get_vertex(vi);
|
int v2 = get_vertex(vi);
|
||||||
++vi;
|
++vi;
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
triangles->add_vertex(v2);
|
if (v0 != v1 && v0 != v2 && v1 != v2) {
|
||||||
triangles->add_vertex(v1);
|
triangles->add_vertex(v0);
|
||||||
|
triangles->add_vertex(v2);
|
||||||
|
triangles->add_vertex(v1);
|
||||||
|
triangles->close_primitive();
|
||||||
|
}
|
||||||
reversed = false;
|
reversed = false;
|
||||||
} else {
|
} else {
|
||||||
triangles->add_vertex(v1);
|
if (v0 != v1 && v0 != v2 && v1 != v2) {
|
||||||
triangles->add_vertex(v2);
|
triangles->add_vertex(v0);
|
||||||
|
triangles->add_vertex(v1);
|
||||||
|
triangles->add_vertex(v2);
|
||||||
|
triangles->close_primitive();
|
||||||
|
}
|
||||||
reversed = true;
|
reversed = true;
|
||||||
}
|
}
|
||||||
v0 = v1;
|
v0 = v1;
|
||||||
v1 = v2;
|
v1 = v2;
|
||||||
triangles->close_primitive();
|
|
||||||
}
|
}
|
||||||
++li;
|
++li;
|
||||||
}
|
}
|
||||||
@ -197,21 +203,27 @@ decompose_impl() const {
|
|||||||
++vi;
|
++vi;
|
||||||
bool reversed = false;
|
bool reversed = false;
|
||||||
while (vi < end) {
|
while (vi < end) {
|
||||||
|
int v2 = get_vertex(vi);
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
triangles->add_vertex(v1);
|
if (v0 != v1 && v0 != v2 && v1 != v2) {
|
||||||
triangles->add_vertex(v0);
|
triangles->add_vertex(v1);
|
||||||
|
triangles->add_vertex(v0);
|
||||||
|
triangles->add_vertex(v2);
|
||||||
|
triangles->close_primitive();
|
||||||
|
}
|
||||||
reversed = false;
|
reversed = false;
|
||||||
} else {
|
} else {
|
||||||
triangles->add_vertex(v0);
|
if (v0 != v1 && v0 != v2 && v1 != v2) {
|
||||||
triangles->add_vertex(v1);
|
triangles->add_vertex(v0);
|
||||||
|
triangles->add_vertex(v1);
|
||||||
|
triangles->add_vertex(v2);
|
||||||
|
triangles->close_primitive();
|
||||||
|
}
|
||||||
reversed = true;
|
reversed = true;
|
||||||
}
|
}
|
||||||
int v2 = get_vertex(vi);
|
|
||||||
++vi;
|
++vi;
|
||||||
triangles->add_vertex(v2);
|
|
||||||
v0 = v1;
|
v0 = v1;
|
||||||
v1 = v2;
|
v1 = v2;
|
||||||
triangles->close_primitive();
|
|
||||||
}
|
}
|
||||||
++li;
|
++li;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,43 @@ GeomVertexReader(const GeomVertexArrayData *array_data, int column) :
|
|||||||
set_column(column);
|
set_column(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GeomVertexReader::Copy Constructor
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE GeomVertexReader::
|
||||||
|
GeomVertexReader(const GeomVertexReader ©) :
|
||||||
|
_vertex_data(copy._vertex_data),
|
||||||
|
_array(copy._array),
|
||||||
|
_array_data(copy._array_data),
|
||||||
|
_packer(copy._packer),
|
||||||
|
_stride(copy._stride),
|
||||||
|
_pointer_begin(copy._pointer_begin),
|
||||||
|
_pointer_end(copy._pointer_end),
|
||||||
|
_pointer(copy._pointer),
|
||||||
|
_start_row(copy._start_row)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GeomVertexReader::Copy Assignment Operator
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void GeomVertexReader::
|
||||||
|
operator = (const GeomVertexReader ©) {
|
||||||
|
_vertex_data = copy._vertex_data;
|
||||||
|
_array = copy._array;
|
||||||
|
_array_data = copy._array_data;
|
||||||
|
_packer = copy._packer;
|
||||||
|
_stride = copy._stride;
|
||||||
|
_pointer_begin = copy._pointer_begin;
|
||||||
|
_pointer_end = copy._pointer_end;
|
||||||
|
_pointer = copy._pointer;
|
||||||
|
_start_row = copy._start_row;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GeomVertexReader::Destructor
|
// Function: GeomVertexReader::Destructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -61,12 +61,14 @@ class EXPCL_PANDA GeomVertexReader : public GeomEnums {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE GeomVertexReader(const GeomVertexData *vertex_data);
|
INLINE GeomVertexReader(const GeomVertexData *vertex_data);
|
||||||
INLINE GeomVertexReader(const GeomVertexData *vertex_data,
|
INLINE GeomVertexReader(const GeomVertexData *vertex_data,
|
||||||
const string &name);
|
const string &name);
|
||||||
INLINE GeomVertexReader(const GeomVertexData *vertex_data,
|
INLINE GeomVertexReader(const GeomVertexData *vertex_data,
|
||||||
const InternalName *name);
|
const InternalName *name);
|
||||||
INLINE GeomVertexReader(const GeomVertexArrayData *array_data);
|
INLINE GeomVertexReader(const GeomVertexArrayData *array_data);
|
||||||
INLINE GeomVertexReader(const GeomVertexArrayData *array_data,
|
INLINE GeomVertexReader(const GeomVertexArrayData *array_data,
|
||||||
int column);
|
int column);
|
||||||
|
INLINE GeomVertexReader(const GeomVertexReader ©);
|
||||||
|
INLINE void operator = (const GeomVertexReader ©);
|
||||||
INLINE ~GeomVertexReader();
|
INLINE ~GeomVertexReader();
|
||||||
|
|
||||||
INLINE const GeomVertexData *get_vertex_data() const;
|
INLINE const GeomVertexData *get_vertex_data() const;
|
||||||
|
@ -87,6 +87,29 @@ GeomVertexRewriter(GeomVertexArrayData *array_data, int column) :
|
|||||||
set_column(column);
|
set_column(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GeomVertexRewriter::Copy Constructor
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE GeomVertexRewriter::
|
||||||
|
GeomVertexRewriter(const GeomVertexRewriter ©) :
|
||||||
|
GeomVertexWriter(copy),
|
||||||
|
GeomVertexReader(copy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GeomVertexRewriter::Copy Assignment Operator
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void GeomVertexRewriter::
|
||||||
|
operator = (const GeomVertexRewriter ©) {
|
||||||
|
GeomVertexWriter::operator = (copy);
|
||||||
|
GeomVertexReader::operator = (copy);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GeomVertexRewriter::Destructor
|
// Function: GeomVertexRewriter::Destructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -44,12 +44,14 @@ class EXPCL_PANDA GeomVertexRewriter : public GeomVertexWriter, public GeomVerte
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE GeomVertexRewriter(GeomVertexData *vertex_data);
|
INLINE GeomVertexRewriter(GeomVertexData *vertex_data);
|
||||||
INLINE GeomVertexRewriter(GeomVertexData *vertex_data,
|
INLINE GeomVertexRewriter(GeomVertexData *vertex_data,
|
||||||
const string &name);
|
const string &name);
|
||||||
INLINE GeomVertexRewriter(GeomVertexData *vertex_data,
|
INLINE GeomVertexRewriter(GeomVertexData *vertex_data,
|
||||||
const InternalName *name);
|
const InternalName *name);
|
||||||
INLINE GeomVertexRewriter(GeomVertexArrayData *array_data);
|
INLINE GeomVertexRewriter(GeomVertexArrayData *array_data);
|
||||||
INLINE GeomVertexRewriter(GeomVertexArrayData *array_data,
|
INLINE GeomVertexRewriter(GeomVertexArrayData *array_data,
|
||||||
int column);
|
int column);
|
||||||
|
INLINE GeomVertexRewriter(const GeomVertexRewriter ©);
|
||||||
|
INLINE void operator = (const GeomVertexRewriter ©);
|
||||||
INLINE ~GeomVertexRewriter();
|
INLINE ~GeomVertexRewriter();
|
||||||
|
|
||||||
INLINE GeomVertexData *get_vertex_data() const;
|
INLINE GeomVertexData *get_vertex_data() const;
|
||||||
|
@ -87,6 +87,43 @@ GeomVertexWriter(GeomVertexArrayData *array_data, int column) :
|
|||||||
set_column(column);
|
set_column(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GeomVertexWriter::Copy Constructor
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE GeomVertexWriter::
|
||||||
|
GeomVertexWriter(const GeomVertexWriter ©) :
|
||||||
|
_vertex_data(copy._vertex_data),
|
||||||
|
_array(copy._array),
|
||||||
|
_array_data(copy._array_data),
|
||||||
|
_packer(copy._packer),
|
||||||
|
_stride(copy._stride),
|
||||||
|
_pointer_begin(copy._pointer_begin),
|
||||||
|
_pointer_end(copy._pointer_end),
|
||||||
|
_pointer(copy._pointer),
|
||||||
|
_start_row(copy._start_row)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GeomVertexWriter::Copy Assignment Operator
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void GeomVertexWriter::
|
||||||
|
operator = (const GeomVertexWriter ©) {
|
||||||
|
_vertex_data = copy._vertex_data;
|
||||||
|
_array = copy._array;
|
||||||
|
_array_data = copy._array_data;
|
||||||
|
_packer = copy._packer;
|
||||||
|
_stride = copy._stride;
|
||||||
|
_pointer_begin = copy._pointer_begin;
|
||||||
|
_pointer_end = copy._pointer_end;
|
||||||
|
_pointer = copy._pointer;
|
||||||
|
_start_row = copy._start_row;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GeomVertexWriter::Destructor
|
// Function: GeomVertexWriter::Destructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -74,12 +74,14 @@ class EXPCL_PANDA GeomVertexWriter : public GeomEnums {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE GeomVertexWriter(GeomVertexData *vertex_data);
|
INLINE GeomVertexWriter(GeomVertexData *vertex_data);
|
||||||
INLINE GeomVertexWriter(GeomVertexData *vertex_data,
|
INLINE GeomVertexWriter(GeomVertexData *vertex_data,
|
||||||
const string &name);
|
const string &name);
|
||||||
INLINE GeomVertexWriter(GeomVertexData *vertex_data,
|
INLINE GeomVertexWriter(GeomVertexData *vertex_data,
|
||||||
const InternalName *name);
|
const InternalName *name);
|
||||||
INLINE GeomVertexWriter(GeomVertexArrayData *array_data);
|
INLINE GeomVertexWriter(GeomVertexArrayData *array_data);
|
||||||
INLINE GeomVertexWriter(GeomVertexArrayData *array_data,
|
INLINE GeomVertexWriter(GeomVertexArrayData *array_data,
|
||||||
int column);
|
int column);
|
||||||
|
INLINE GeomVertexWriter(const GeomVertexWriter ©);
|
||||||
|
INLINE void operator = (const GeomVertexWriter ©);
|
||||||
INLINE ~GeomVertexWriter();
|
INLINE ~GeomVertexWriter();
|
||||||
|
|
||||||
INLINE GeomVertexData *get_vertex_data() const;
|
INLINE GeomVertexData *get_vertex_data() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user