Revision: 65189
http://sourceforge.net/p/brlcad/code/65189
Author: ejno
Date: 2015-06-04 21:30:13 +0000 (Thu, 04 Jun 2015)
Log Message:
-----------
write colors for all regions
Modified Paths:
--------------
brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp
Modified: brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp
===================================================================
--- brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp 2015-06-04
21:07:30 UTC (rev 65188)
+++ brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp 2015-06-04
21:30:13 UTC (rev 65189)
@@ -69,6 +69,15 @@
};
+HIDDEN void
+char_color_from_floats(unsigned char *color, const float *float_color)
+{
+ color[0] = static_cast<unsigned char>(float_color[0] * 255.0 + 0.5);
+ color[1] = static_cast<unsigned char>(float_color[1] * 255.0 + 0.5);
+ color[2] = static_cast<unsigned char>(float_color[2] * 255.0 + 0.5);
+}
+
+
class RecordWriter
{
public:
@@ -1251,9 +1260,7 @@
try {
unsigned char char_color[3];
- char_color[0] = static_cast<unsigned char>(color[0] * 255.0 + 0.5);
- char_color[1] = static_cast<unsigned char>(color[1] * 255.0 + 0.5);
- char_color[2] = static_cast<unsigned char>(color[2] * 255.0 + 0.5);
+ char_color_from_floats(char_color, color);
Section section(bot->mode == RT_BOT_SOLID);
write_bot(section, *bot);
section.write(data.m_writer, name, char_color);
@@ -1311,7 +1318,9 @@
const std::string name = AutoFreePtr<char>(db_path_to_string(path)).ptr;
const Section §ion = *data.m_sections.at(path->fp_names[path->fp_len -
1]);
- section.write(data.m_writer, name); // TODO
+ unsigned char color[3];
+ char_color_from_floats(color, tree_state->ts_mater.ma_color);
+ section.write(data.m_writer, name, color); // TODO
if (current_tree->tr_op != OP_NOP) {
gcv_region_end_data gcv_data = {write_nmg_region, &data};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits