Import: Fix of alpha channel misinterpretation
This commit is contained in:
@@ -63,7 +63,7 @@ using namespace Import;
|
||||
ExportOCAFOptions::ExportOCAFOptions()
|
||||
{
|
||||
defaultColor.setPackedValue(0xCCCCCC00);
|
||||
defaultColor.a = 0;
|
||||
defaultColor.a = 1;
|
||||
}
|
||||
|
||||
ExportOCAF2::ExportOCAF2(Handle(TDocStd_Document) h, GetShapeColorsFunc func)
|
||||
@@ -94,7 +94,7 @@ ExportOCAFOptions ExportOCAF2::customExportOptions()
|
||||
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
defaultOptions.defaultColor.setPackedValue(
|
||||
handle->GetUnsigned("DefaultShapeColor", defaultOptions.defaultColor.getPackedValue()));
|
||||
defaultOptions.defaultColor.a = 0;
|
||||
defaultOptions.defaultColor.a = 1;
|
||||
|
||||
return defaultOptions;
|
||||
}
|
||||
|
||||
@@ -72,10 +72,10 @@ using namespace Import;
|
||||
ImportOCAFOptions::ImportOCAFOptions()
|
||||
{
|
||||
defaultFaceColor.setPackedValue(0xCCCCCC00);
|
||||
defaultFaceColor.a = 0;
|
||||
defaultFaceColor.a = 1.0F;
|
||||
|
||||
defaultEdgeColor.setPackedValue(421075455UL);
|
||||
defaultEdgeColor.a = 0;
|
||||
defaultEdgeColor.a = 1.0F;
|
||||
}
|
||||
|
||||
ImportOCAF2::ImportOCAF2(Handle(TDocStd_Document) hDoc, App::Document* doc, const std::string& name)
|
||||
@@ -114,12 +114,12 @@ ImportOCAFOptions ImportOCAF2::customImportOptions()
|
||||
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
defaultOptions.defaultFaceColor.setPackedValue(
|
||||
hGrp->GetUnsigned("DefaultShapeColor", defaultOptions.defaultFaceColor.getPackedValue()));
|
||||
defaultOptions.defaultFaceColor.a = 0;
|
||||
defaultOptions.defaultFaceColor.a = 1.0F;
|
||||
|
||||
defaultOptions.defaultEdgeColor.setPackedValue(
|
||||
hGrp->GetUnsigned("DefaultShapeLineColor",
|
||||
defaultOptions.defaultEdgeColor.getPackedValue()));
|
||||
defaultOptions.defaultEdgeColor.a = 0;
|
||||
defaultOptions.defaultEdgeColor.a = 1.0F;
|
||||
|
||||
return defaultOptions;
|
||||
}
|
||||
@@ -353,9 +353,6 @@ bool ImportOCAF2::createObject(App::Document* doc,
|
||||
hasFaceColors = true;
|
||||
info.hasFaceColor = true;
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundEdgeColor) {
|
||||
|
||||
@@ -53,12 +53,12 @@ App::Color Tools::convertColor(const Quantity_ColorRGBA& rgba)
|
||||
return App::Color(static_cast<float>(red),
|
||||
static_cast<float>(green),
|
||||
static_cast<float>(blue),
|
||||
1.0f - static_cast<float>(rgba.Alpha()));
|
||||
static_cast<float>(rgba.Alpha()));
|
||||
}
|
||||
|
||||
Quantity_ColorRGBA Tools::convertColor(const App::Color& col)
|
||||
{
|
||||
return Quantity_ColorRGBA(Quantity_Color(col.r, col.g, col.b, OCC_COLOR_SPACE), 1.0f - col.a);
|
||||
return Quantity_ColorRGBA(Quantity_Color(col.r, col.g, col.b, OCC_COLOR_SPACE), col.a);
|
||||
}
|
||||
|
||||
static inline std::ostream& operator<<(std::ostream& os, const Quantity_ColorRGBA& rgba)
|
||||
|
||||
@@ -51,7 +51,7 @@ void ImportOCAFGui::applyFaceColors(Part::Feature* part, const std::vector<App::
|
||||
|
||||
if (colors.size() == 1) {
|
||||
vp->ShapeAppearance.setDiffuseColor(colors.front());
|
||||
vp->Transparency.setValue(100 * colors.front().a);
|
||||
vp->Transparency.setValue(100 * colors.front().transparency());
|
||||
}
|
||||
else {
|
||||
vp->ShapeAppearance.setDiffuseColors(colors);
|
||||
|
||||
Reference in New Issue
Block a user