|
@@ -28,7 +28,7 @@ TypeHandle GeomVertexArrayFormat::_type_handle;
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
GeomVertexArrayFormat() :
|
|
GeomVertexArrayFormat() :
|
|
@@ -36,6 +36,7 @@ GeomVertexArrayFormat() :
|
|
|
_stride(0),
|
|
_stride(0),
|
|
|
_total_bytes(0),
|
|
_total_bytes(0),
|
|
|
_pad_to(1),
|
|
_pad_to(1),
|
|
|
|
|
+ _divisor(0),
|
|
|
_columns_unsorted(false)
|
|
_columns_unsorted(false)
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
@@ -43,7 +44,7 @@ GeomVertexArrayFormat() :
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
@@ -53,6 +54,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
_stride(0),
|
|
_stride(0),
|
|
|
_total_bytes(0),
|
|
_total_bytes(0),
|
|
|
_pad_to(1),
|
|
_pad_to(1),
|
|
|
|
|
+ _divisor(0),
|
|
|
_columns_unsorted(false)
|
|
_columns_unsorted(false)
|
|
|
{
|
|
{
|
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
@@ -61,7 +63,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
@@ -74,6 +76,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
_stride(0),
|
|
_stride(0),
|
|
|
_total_bytes(0),
|
|
_total_bytes(0),
|
|
|
_pad_to(1),
|
|
_pad_to(1),
|
|
|
|
|
+ _divisor(0),
|
|
|
_columns_unsorted(false)
|
|
_columns_unsorted(false)
|
|
|
{
|
|
{
|
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
@@ -83,7 +86,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
@@ -99,6 +102,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
_stride(0),
|
|
_stride(0),
|
|
|
_total_bytes(0),
|
|
_total_bytes(0),
|
|
|
_pad_to(1),
|
|
_pad_to(1),
|
|
|
|
|
+ _divisor(0),
|
|
|
_columns_unsorted(false)
|
|
_columns_unsorted(false)
|
|
|
{
|
|
{
|
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
@@ -109,7 +113,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
// Function: GeomVertexArrayFormat::Constructor
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
@@ -128,6 +132,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
_stride(0),
|
|
_stride(0),
|
|
|
_total_bytes(0),
|
|
_total_bytes(0),
|
|
|
_pad_to(1),
|
|
_pad_to(1),
|
|
|
|
|
+ _divisor(0),
|
|
|
_columns_unsorted(false)
|
|
_columns_unsorted(false)
|
|
|
{
|
|
{
|
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
add_column(name0, num_components0, numeric_type0, contents0);
|
|
@@ -139,7 +144,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0,
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Copy Constructor
|
|
// Function: GeomVertexArrayFormat::Copy Constructor
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
GeomVertexArrayFormat(const GeomVertexArrayFormat ©) :
|
|
GeomVertexArrayFormat(const GeomVertexArrayFormat ©) :
|
|
@@ -147,6 +152,7 @@ GeomVertexArrayFormat(const GeomVertexArrayFormat ©) :
|
|
|
_stride(copy._stride),
|
|
_stride(copy._stride),
|
|
|
_total_bytes(copy._total_bytes),
|
|
_total_bytes(copy._total_bytes),
|
|
|
_pad_to(copy._pad_to),
|
|
_pad_to(copy._pad_to),
|
|
|
|
|
+ _divisor(copy._divisor),
|
|
|
_columns_unsorted(copy._columns_unsorted)
|
|
_columns_unsorted(copy._columns_unsorted)
|
|
|
{
|
|
{
|
|
|
Columns::const_iterator dti;
|
|
Columns::const_iterator dti;
|
|
@@ -158,7 +164,7 @@ GeomVertexArrayFormat(const GeomVertexArrayFormat ©) :
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Copy Assignment Operator
|
|
// Function: GeomVertexArrayFormat::Copy Assignment Operator
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void GeomVertexArrayFormat::
|
|
void GeomVertexArrayFormat::
|
|
|
operator = (const GeomVertexArrayFormat ©) {
|
|
operator = (const GeomVertexArrayFormat ©) {
|
|
@@ -166,6 +172,7 @@ operator = (const GeomVertexArrayFormat ©) {
|
|
|
_stride = copy._stride;
|
|
_stride = copy._stride;
|
|
|
_total_bytes = copy._total_bytes;
|
|
_total_bytes = copy._total_bytes;
|
|
|
_pad_to = copy._pad_to;
|
|
_pad_to = copy._pad_to;
|
|
|
|
|
+ _divisor = copy._divisor;
|
|
|
|
|
|
|
|
_columns.clear();
|
|
_columns.clear();
|
|
|
_columns_by_name.clear();
|
|
_columns_by_name.clear();
|
|
@@ -175,11 +182,11 @@ operator = (const GeomVertexArrayFormat ©) {
|
|
|
add_column(*(*dti));
|
|
add_column(*(*dti));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Destructor
|
|
// Function: GeomVertexArrayFormat::Destructor
|
|
|
// Access: Published, Virtual
|
|
// Access: Published, Virtual
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::
|
|
GeomVertexArrayFormat::
|
|
|
~GeomVertexArrayFormat() {
|
|
~GeomVertexArrayFormat() {
|
|
@@ -228,15 +235,15 @@ unref() const {
|
|
|
// type.
|
|
// type.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
int GeomVertexArrayFormat::
|
|
int GeomVertexArrayFormat::
|
|
|
-add_column(InternalName *name, int num_components,
|
|
|
|
|
- GeomVertexArrayFormat::NumericType numeric_type,
|
|
|
|
|
|
|
+add_column(InternalName *name, int num_components,
|
|
|
|
|
+ GeomVertexArrayFormat::NumericType numeric_type,
|
|
|
GeomVertexArrayFormat::Contents contents, int start,
|
|
GeomVertexArrayFormat::Contents contents, int start,
|
|
|
int column_alignment) {
|
|
int column_alignment) {
|
|
|
if (start < 0) {
|
|
if (start < 0) {
|
|
|
start = _total_bytes;
|
|
start = _total_bytes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return add_column(GeomVertexColumn(name, num_components, numeric_type, contents,
|
|
|
|
|
|
|
+ return add_column(GeomVertexColumn(name, num_components, numeric_type, contents,
|
|
|
start, column_alignment));
|
|
start, column_alignment));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -500,7 +507,7 @@ count_unused_space() const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::output
|
|
// Function: GeomVertexArrayFormat::output
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void GeomVertexArrayFormat::
|
|
void GeomVertexArrayFormat::
|
|
|
output(ostream &out) const {
|
|
output(ostream &out) const {
|
|
@@ -526,7 +533,7 @@ output(ostream &out) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::write
|
|
// Function: GeomVertexArrayFormat::write
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void GeomVertexArrayFormat::
|
|
void GeomVertexArrayFormat::
|
|
|
write(ostream &out, int indent_level) const {
|
|
write(ostream &out, int indent_level) const {
|
|
@@ -537,7 +544,7 @@ write(ostream &out, int indent_level) const {
|
|
|
for (ci = _columns.begin(); ci != _columns.end(); ++ci) {
|
|
for (ci = _columns.begin(); ci != _columns.end(); ++ci) {
|
|
|
const GeomVertexColumn *column = (*ci);
|
|
const GeomVertexColumn *column = (*ci);
|
|
|
indent(out, indent_level + 2)
|
|
indent(out, indent_level + 2)
|
|
|
- << *column
|
|
|
|
|
|
|
+ << *column
|
|
|
<< " " << column->get_numeric_type()
|
|
<< " " << column->get_numeric_type()
|
|
|
<< " " << column->get_contents()
|
|
<< " " << column->get_contents()
|
|
|
<< " start at " << column->get_start() << "\n";
|
|
<< " start at " << column->get_start() << "\n";
|
|
@@ -547,7 +554,7 @@ write(ostream &out, int indent_level) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::write_with_data
|
|
// Function: GeomVertexArrayFormat::write_with_data
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void GeomVertexArrayFormat::
|
|
void GeomVertexArrayFormat::
|
|
|
write_with_data(ostream &out, int indent_level,
|
|
write_with_data(ostream &out, int indent_level,
|
|
@@ -568,7 +575,7 @@ write_with_data(ostream &out, int indent_level,
|
|
|
reader.set_column(0, column);
|
|
reader.set_column(0, column);
|
|
|
const LVecBase4f &d = reader.get_data4f();
|
|
const LVecBase4f &d = reader.get_data4f();
|
|
|
|
|
|
|
|
- indent(out, indent_level + 2)
|
|
|
|
|
|
|
+ indent(out, indent_level + 2)
|
|
|
<< *column->get_name();
|
|
<< *column->get_name();
|
|
|
for (int v = 0; v < num_values; v++) {
|
|
for (int v = 0; v < num_values; v++) {
|
|
|
out << " " << d[v];
|
|
out << " " << d[v];
|
|
@@ -658,7 +665,7 @@ get_format_string(bool pad) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::compare_to
|
|
// Function: GeomVertexArrayFormat::compare_to
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
int GeomVertexArrayFormat::
|
|
int GeomVertexArrayFormat::
|
|
|
compare_to(const GeomVertexArrayFormat &other) const {
|
|
compare_to(const GeomVertexArrayFormat &other) const {
|
|
@@ -671,6 +678,9 @@ compare_to(const GeomVertexArrayFormat &other) const {
|
|
|
if (_pad_to != other._pad_to) {
|
|
if (_pad_to != other._pad_to) {
|
|
|
return _pad_to - other._pad_to;
|
|
return _pad_to - other._pad_to;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (_divisor != other._divisor) {
|
|
|
|
|
+ return _divisor - other._divisor;
|
|
|
|
|
+ }
|
|
|
if (_columns.size() != other._columns.size()) {
|
|
if (_columns.size() != other._columns.size()) {
|
|
|
return (int)_columns.size() - (int)other._columns.size();
|
|
return (int)_columns.size() - (int)other._columns.size();
|
|
|
}
|
|
}
|
|
@@ -720,7 +730,7 @@ do_register() {
|
|
|
nassertv(!_is_registered);
|
|
nassertv(!_is_registered);
|
|
|
_is_registered = true;
|
|
_is_registered = true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::do_unregister
|
|
// Function: GeomVertexArrayFormat::do_unregister
|
|
|
// Access: Private
|
|
// Access: Private
|
|
@@ -756,6 +766,7 @@ write_datagram(BamWriter *manager, Datagram &dg) {
|
|
|
dg.add_uint16(_stride);
|
|
dg.add_uint16(_stride);
|
|
|
dg.add_uint16(_total_bytes);
|
|
dg.add_uint16(_total_bytes);
|
|
|
dg.add_uint8(_pad_to);
|
|
dg.add_uint8(_pad_to);
|
|
|
|
|
+ dg.add_uint16(_divisor);
|
|
|
|
|
|
|
|
consider_sort_columns();
|
|
consider_sort_columns();
|
|
|
|
|
|
|
@@ -845,6 +856,11 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
|
|
_stride = scan.get_uint16();
|
|
_stride = scan.get_uint16();
|
|
|
_total_bytes = scan.get_uint16();
|
|
_total_bytes = scan.get_uint16();
|
|
|
_pad_to = scan.get_uint8();
|
|
_pad_to = scan.get_uint8();
|
|
|
|
|
+ if (manager->get_file_minor_ver() > 36) {
|
|
|
|
|
+ _divisor = scan.get_uint16();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _divisor = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
int num_columns = scan.get_uint16();
|
|
int num_columns = scan.get_uint16();
|
|
|
_columns.reserve(num_columns);
|
|
_columns.reserve(num_columns);
|
|
@@ -859,7 +875,7 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GeomVertexArrayFormat::Registry::Constructor
|
|
// Function: GeomVertexArrayFormat::Registry::Constructor
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
-// Description:
|
|
|
|
|
|
|
+// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
GeomVertexArrayFormat::Registry::
|
|
GeomVertexArrayFormat::Registry::
|
|
|
Registry() {
|
|
Registry() {
|
|
@@ -890,7 +906,7 @@ register_format(GeomVertexArrayFormat *format) {
|
|
|
// a zero reference count and is not added into the map below, it
|
|
// a zero reference count and is not added into the map below, it
|
|
|
// will be automatically deleted when this function returns.
|
|
// will be automatically deleted when this function returns.
|
|
|
PT(GeomVertexArrayFormat) pt_format = format;
|
|
PT(GeomVertexArrayFormat) pt_format = format;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
GeomVertexArrayFormat *new_format;
|
|
GeomVertexArrayFormat *new_format;
|
|
|
{
|
|
{
|
|
|
LightMutexHolder holder(_lock);
|
|
LightMutexHolder holder(_lock);
|