36 if (!FltRecord::extract_record(reader)) {
40 nassertr(reader.
get_opcode() == FO_local_vertex_pool,
false);
46 for (
int i = 0; i < num_vertices; i++) {
48 _vertices.push_back(vertex);
50 if ((attributes & AM_has_position) != 0) {
56 if ((attributes & AM_has_color_index) != 0) {
59 }
else if ((attributes & AM_has_packed_color) != 0) {
60 if (!vertex->_packed_color.extract_record(reader)) {
63 vertex->_flags |= FltVertex::F_packed_color;
66 vertex->_flags |= FltVertex::F_no_color;
69 if ((attributes & AM_has_normal) != 0) {
73 vertex->_has_normal =
true;
76 if ((attributes & AM_has_base_uv) != 0) {
79 vertex->_has_uv =
true;
82 if ((attributes & AM_has_uv_1) != 0) {
87 if ((attributes & AM_has_uv_2) != 0) {
92 if ((attributes & AM_has_uv_3) != 0) {
97 if ((attributes & AM_has_uv_4) != 0) {
102 if ((attributes & AM_has_uv_5) != 0) {
107 if ((attributes & AM_has_uv_6) != 0) {
112 if ((attributes & AM_has_uv_7) != 0) {
129 if (!FltRecord::build_record(writer)) {
137 int attributes = AM_has_position;
139 Vertices::const_iterator vi;
140 for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) {
142 if ((vertex->_flags & FltVertex::F_no_color) != 0) {
145 }
else if ((vertex->_flags & FltVertex::F_packed_color) != 0) {
147 attributes |= AM_has_packed_color;
151 attributes |= AM_has_color_index;
154 if (vertex->_has_normal) {
155 attributes |= AM_has_normal;
158 if (vertex->_has_uv) {
159 attributes |= AM_has_base_uv;
163 if ((attributes & AM_has_packed_color) != 0 &&
164 (attributes & AM_has_color_index) != 0) {
167 attributes &= ~AM_has_color_index;
174 for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) {
177 if ((attributes & AM_has_position) != 0) {
183 if ((attributes & AM_has_color_index) != 0) {
184 if ((vertex->_flags & (FltVertex::F_no_color | FltVertex::F_packed_color)) != 0) {
186 datagram.
add_be_int32(_header->get_closest_rgb(LRGBColor(1.0, 1.0, 1.0)));
191 }
else if ((attributes & AM_has_packed_color) != 0) {
202 color.
set_color(LColor(1.0, 1.0, 1.0, 1.0));
205 if (!color.build_record(writer)) {
210 if ((attributes & AM_has_normal) != 0) {
211 if (!vertex->_has_normal) {
222 if ((attributes & AM_has_base_uv) != 0) {
223 if (!vertex->_has_uv) {