|
@@ -271,10 +271,15 @@ set_color(Geom *geom, const LColor &color) {
|
|
|
// We have not yet converted these colors. Do so now.
|
|
// We have not yet converted these colors. Do so now.
|
|
|
if (sc._vertex_data->has_column(InternalName::get_color())) {
|
|
if (sc._vertex_data->has_column(InternalName::get_color())) {
|
|
|
new_data._vdata = sc._vertex_data->set_color(color);
|
|
new_data._vdata = sc._vertex_data->set_color(color);
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (vertex_colors_prefer_packed) {
|
|
|
new_data._vdata = sc._vertex_data->set_color
|
|
new_data._vdata = sc._vertex_data->set_color
|
|
|
(color, 1, Geom::NT_packed_dabc, Geom::C_color);
|
|
(color, 1, Geom::NT_packed_dabc, Geom::C_color);
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ new_data._vdata = sc._vertex_data->set_color
|
|
|
|
|
+ (color, 4, Geom::NT_uint8, Geom::C_color);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
geom->set_vertex_data(new_data._vdata);
|
|
geom->set_vertex_data(new_data._vdata);
|
|
@@ -330,10 +335,15 @@ transform_colors(Geom *geom, const LVecBase4 &scale) {
|
|
|
// We have not yet converted these colors. Do so now.
|
|
// We have not yet converted these colors. Do so now.
|
|
|
if (sc._vertex_data->has_column(InternalName::get_color())) {
|
|
if (sc._vertex_data->has_column(InternalName::get_color())) {
|
|
|
new_data._vdata = sc._vertex_data->scale_color(scale);
|
|
new_data._vdata = sc._vertex_data->scale_color(scale);
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (vertex_colors_prefer_packed) {
|
|
|
new_data._vdata = sc._vertex_data->set_color
|
|
new_data._vdata = sc._vertex_data->set_color
|
|
|
(scale, 1, Geom::NT_packed_dabc, Geom::C_color);
|
|
(scale, 1, Geom::NT_packed_dabc, Geom::C_color);
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ new_data._vdata = sc._vertex_data->set_color
|
|
|
|
|
+ (scale, 4, Geom::NT_uint8, Geom::C_color);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
geom->set_vertex_data(new_data._vdata);
|
|
geom->set_vertex_data(new_data._vdata);
|
|
@@ -468,12 +478,18 @@ apply_texture_colors(Geom *geom, TextureStage *ts, Texture *tex,
|
|
|
// Make sure the vdata has a color column.
|
|
// Make sure the vdata has a color column.
|
|
|
if (stc._vertex_data->has_column(InternalName::get_color())) {
|
|
if (stc._vertex_data->has_column(InternalName::get_color())) {
|
|
|
vdata = new GeomVertexData(*stc._vertex_data);
|
|
vdata = new GeomVertexData(*stc._vertex_data);
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (vertex_colors_prefer_packed) {
|
|
|
// Create a color column where there wasn't one before.
|
|
// Create a color column where there wasn't one before.
|
|
|
vdata = new GeomVertexData(*stc._vertex_data->set_color
|
|
vdata = new GeomVertexData(*stc._vertex_data->set_color
|
|
|
(LColor(1.0f, 1.0f, 1.0f, 1.0f), 1, Geom::NT_packed_dabc, Geom::C_color));
|
|
(LColor(1.0f, 1.0f, 1.0f, 1.0f), 1, Geom::NT_packed_dabc, Geom::C_color));
|
|
|
keep_vertex_color = false;
|
|
keep_vertex_color = false;
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ vdata = new GeomVertexData(*stc._vertex_data->set_color
|
|
|
|
|
+ (LColor(1.0f, 1.0f, 1.0f, 1.0f), 4, Geom::NT_uint8, Geom::C_color));
|
|
|
|
|
+ keep_vertex_color = false;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Check whether it has 2-d or 3-d texture coordinates.
|
|
// Check whether it has 2-d or 3-d texture coordinates.
|
|
|
bool tex3d = false;
|
|
bool tex3d = false;
|