mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0032143: Visualization - add option excluding transparent object from sorting
Added option Graphic3d_AlphaMode_MaskBlend combining Mask (no sorting) and Blend (enable blending with background) behavior.
This commit is contained in:
parent
ba590cbf15
commit
33425a46b8
@ -27,6 +27,7 @@ static Standard_Byte alphaModeToChar (Graphic3d_AlphaMode theMode)
|
|||||||
case Graphic3d_AlphaMode_Opaque: return 'O';
|
case Graphic3d_AlphaMode_Opaque: return 'O';
|
||||||
case Graphic3d_AlphaMode_Mask: return 'M';
|
case Graphic3d_AlphaMode_Mask: return 'M';
|
||||||
case Graphic3d_AlphaMode_Blend: return 'B';
|
case Graphic3d_AlphaMode_Blend: return 'B';
|
||||||
|
case Graphic3d_AlphaMode_MaskBlend: return 'b';
|
||||||
case Graphic3d_AlphaMode_BlendAuto: return 'A';
|
case Graphic3d_AlphaMode_BlendAuto: return 'A';
|
||||||
}
|
}
|
||||||
return 'A';
|
return 'A';
|
||||||
@ -40,6 +41,7 @@ static Graphic3d_AlphaMode alphaModeFromChar (Standard_Byte theMode)
|
|||||||
case 'O': return Graphic3d_AlphaMode_Opaque;
|
case 'O': return Graphic3d_AlphaMode_Opaque;
|
||||||
case 'M': return Graphic3d_AlphaMode_Mask;
|
case 'M': return Graphic3d_AlphaMode_Mask;
|
||||||
case 'B': return Graphic3d_AlphaMode_Blend;
|
case 'B': return Graphic3d_AlphaMode_Blend;
|
||||||
|
case 'b': return Graphic3d_AlphaMode_MaskBlend;
|
||||||
case 'A': return Graphic3d_AlphaMode_BlendAuto;
|
case 'A': return Graphic3d_AlphaMode_BlendAuto;
|
||||||
}
|
}
|
||||||
return Graphic3d_AlphaMode_BlendAuto;
|
return Graphic3d_AlphaMode_BlendAuto;
|
||||||
|
@ -20,6 +20,7 @@ enum Graphic3d_AlphaMode
|
|||||||
Graphic3d_AlphaMode_Opaque = 0, //!< rendered output is fully opaque and alpha value is ignored
|
Graphic3d_AlphaMode_Opaque = 0, //!< rendered output is fully opaque and alpha value is ignored
|
||||||
Graphic3d_AlphaMode_Mask, //!< rendered output is either fully opaque or fully transparent depending on the alpha value and the alpha cutoff value
|
Graphic3d_AlphaMode_Mask, //!< rendered output is either fully opaque or fully transparent depending on the alpha value and the alpha cutoff value
|
||||||
Graphic3d_AlphaMode_Blend, //!< rendered output is combined with the background
|
Graphic3d_AlphaMode_Blend, //!< rendered output is combined with the background
|
||||||
|
Graphic3d_AlphaMode_MaskBlend, //!< performs in-place blending (without implicit reordering of opaque objects) with alpha-test
|
||||||
|
|
||||||
Graphic3d_AlphaMode_BlendAuto = -1, //!< special value defined for backward compatibility - it is equal to Graphic3d_AlphaMode_Blend when Material transparency is not zero and Graphic3d_AlphaMode_Opaque otherwise;
|
Graphic3d_AlphaMode_BlendAuto = -1, //!< special value defined for backward compatibility - it is equal to Graphic3d_AlphaMode_Blend when Material transparency is not zero and Graphic3d_AlphaMode_Opaque otherwise;
|
||||||
// since this check ignores possible transparency defined by per-vertex colors and textures - NOT recommended to use!
|
// since this check ignores possible transparency defined by per-vertex colors and textures - NOT recommended to use!
|
||||||
|
@ -23,10 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Graphic3d_Aspects)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_AspectText3d::Graphic3d_AspectText3d()
|
Graphic3d_AspectText3d::Graphic3d_AspectText3d()
|
||||||
{
|
{
|
||||||
// actually this should be a special state Graphic3d_AlphaMode_MaskBlend
|
SetAlphaMode (Graphic3d_AlphaMode_MaskBlend, 0.285f);
|
||||||
// since text is drawn in usual order with normal opaque objects (thanks to alpha test),
|
|
||||||
// but blending is also enabled to smoothen boundaries
|
|
||||||
SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
|
|
||||||
myShadingModel = Graphic3d_TOSM_UNLIT;
|
myShadingModel = Graphic3d_TOSM_UNLIT;
|
||||||
myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
|
myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
|
||||||
myEdgeColor.SetRGB (Quantity_NOC_WHITE);
|
myEdgeColor.SetRGB (Quantity_NOC_WHITE);
|
||||||
@ -43,7 +40,7 @@ Graphic3d_AspectText3d::Graphic3d_AspectText3d (const Quantity_Color& theColor,
|
|||||||
Aspect_TypeOfStyleText theStyle,
|
Aspect_TypeOfStyleText theStyle,
|
||||||
Aspect_TypeOfDisplayText theDisplayType)
|
Aspect_TypeOfDisplayText theDisplayType)
|
||||||
{
|
{
|
||||||
SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
|
SetAlphaMode (Graphic3d_AlphaMode_MaskBlend, 0.285f);
|
||||||
myShadingModel = Graphic3d_TOSM_UNLIT;
|
myShadingModel = Graphic3d_TOSM_UNLIT;
|
||||||
myTextStyle = theStyle;
|
myTextStyle = theStyle;
|
||||||
myTextDisplayType = theDisplayType;
|
myTextDisplayType = theDisplayType;
|
||||||
|
@ -2445,7 +2445,8 @@ void OpenGl_Context::SetShadingMaterial (const OpenGl_Aspects* theAspect,
|
|||||||
// do not update material properties in case of zero reflection mode,
|
// do not update material properties in case of zero reflection mode,
|
||||||
// because GL lighting will be disabled by OpenGl_PrimitiveArray::DrawArray() anyway.
|
// because GL lighting will be disabled by OpenGl_PrimitiveArray::DrawArray() anyway.
|
||||||
const OpenGl_MaterialState& aMatState = myShaderManager->MaterialState();
|
const OpenGl_MaterialState& aMatState = myShaderManager->MaterialState();
|
||||||
float anAlphaCutoff = anAspect->AlphaMode() == Graphic3d_AlphaMode_Mask
|
float anAlphaCutoff = (anAspect->AlphaMode() == Graphic3d_AlphaMode_Mask
|
||||||
|
|| anAspect->AlphaMode() == Graphic3d_AlphaMode_MaskBlend)
|
||||||
? anAspect->AlphaCutoff()
|
? anAspect->AlphaCutoff()
|
||||||
: ShortRealLast();
|
: ShortRealLast();
|
||||||
if (anAspect->ToDrawEdges())
|
if (anAspect->ToDrawEdges())
|
||||||
@ -2513,6 +2514,7 @@ Standard_Boolean OpenGl_Context::CheckIsTransparent (const OpenGl_Aspects* theAs
|
|||||||
return theAlphaFront < 1.0f
|
return theAlphaFront < 1.0f
|
||||||
|| theAlphaBack < 1.0f;
|
|| theAlphaBack < 1.0f;
|
||||||
}
|
}
|
||||||
|
// Graphic3d_AlphaMode_Mask and Graphic3d_AlphaMode_MaskBlend are not considered transparent here
|
||||||
return anAspect->AlphaMode() == Graphic3d_AlphaMode_Blend;
|
return anAspect->AlphaMode() == Graphic3d_AlphaMode_Blend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,11 +109,13 @@ void OpenGl_GraduatedTrihedron::initGlResources (const Handle(OpenGl_Context)& t
|
|||||||
|
|
||||||
myLabelValues.SetFontSize (theCtx, myData.ValuesSize());
|
myLabelValues.SetFontSize (theCtx, myData.ValuesSize());
|
||||||
|
|
||||||
|
myAspectLabels.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_MaskBlend, 0.285f);
|
||||||
myAspectLabels.Aspect()->SetTextFontAspect (myData.NamesFontAspect());
|
myAspectLabels.Aspect()->SetTextFontAspect (myData.NamesFontAspect());
|
||||||
myAspectLabels.Aspect()->SetTextFont (!myData.NamesFont().IsEmpty()
|
myAspectLabels.Aspect()->SetTextFont (!myData.NamesFont().IsEmpty()
|
||||||
? new TCollection_HAsciiString (myData.NamesFont())
|
? new TCollection_HAsciiString (myData.NamesFont())
|
||||||
: Handle(TCollection_HAsciiString )());
|
: Handle(TCollection_HAsciiString )());
|
||||||
|
|
||||||
|
myAspectValues.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_MaskBlend, 0.285f);
|
||||||
myAspectValues.Aspect()->SetTextFontAspect (myData.ValuesFontAspect());
|
myAspectValues.Aspect()->SetTextFontAspect (myData.ValuesFontAspect());
|
||||||
myAspectValues.Aspect()->SetTextFont (!myData.ValuesFont().IsEmpty()
|
myAspectValues.Aspect()->SetTextFont (!myData.ValuesFont().IsEmpty()
|
||||||
? new TCollection_HAsciiString (myData.ValuesFont())
|
? new TCollection_HAsciiString (myData.ValuesFont())
|
||||||
|
@ -1009,6 +1009,13 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
|||||||
}
|
}
|
||||||
aCtx->SetSampleAlphaToCoverage (aCtx->ShaderManager()->MaterialState().HasAlphaCutoff());
|
aCtx->SetSampleAlphaToCoverage (aCtx->ShaderManager()->MaterialState().HasAlphaCutoff());
|
||||||
|
|
||||||
|
const bool isForcedBlend = anAspectFace->Aspect()->AlphaMode() == Graphic3d_AlphaMode_MaskBlend;
|
||||||
|
if (isForcedBlend)
|
||||||
|
{
|
||||||
|
aCtx->core11fwd->glEnable (GL_BLEND);
|
||||||
|
aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
|
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
|
||||||
? myBounds->Colors
|
? myBounds->Colors
|
||||||
: NULL;
|
: NULL;
|
||||||
@ -1024,6 +1031,10 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
||||||
|
if (isForcedBlend)
|
||||||
|
{
|
||||||
|
aCtx->core11fwd->glDisable (GL_BLEND);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,6 +1060,11 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
|||||||
|
|
||||||
aCtx->core11fwd->glCullFace (GL_BACK);
|
aCtx->core11fwd->glCullFace (GL_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isForcedBlend)
|
||||||
|
{
|
||||||
|
aCtx->core11fwd->glDisable (GL_BLEND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
|
@ -578,7 +578,8 @@ protected:
|
|||||||
Standard_Boolean theEnableMeshEdges) const
|
Standard_Boolean theEnableMeshEdges) const
|
||||||
{
|
{
|
||||||
Standard_Integer aBits = 0;
|
Standard_Integer aBits = 0;
|
||||||
if (theAlphaMode == Graphic3d_AlphaMode_Mask)
|
if (theAlphaMode == Graphic3d_AlphaMode_Mask
|
||||||
|
|| theAlphaMode == Graphic3d_AlphaMode_MaskBlend)
|
||||||
{
|
{
|
||||||
aBits |= Graphic3d_ShaderFlags_AlphaTest;
|
aBits |= Graphic3d_ShaderFlags_AlphaTest;
|
||||||
}
|
}
|
||||||
|
@ -759,7 +759,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
&& theTextAspect.Aspect()->TextStyle() != Aspect_TOST_ANNOTATION;
|
&& theTextAspect.Aspect()->TextStyle() != Aspect_TOST_ANNOTATION;
|
||||||
if (!hasDepthTest)
|
if (!hasDepthTest)
|
||||||
{
|
{
|
||||||
glDisable (GL_DEPTH_TEST);
|
theCtx->core11fwd->glDisable (GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theCtx->core15fwd != NULL)
|
if (theCtx->core15fwd != NULL)
|
||||||
@ -782,8 +782,11 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// setup blending
|
// setup blending
|
||||||
glEnable (GL_BLEND);
|
if (theTextAspect.Aspect()->AlphaMode() == Graphic3d_AlphaMode_MaskBlend)
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
{
|
||||||
|
theCtx->core11fwd->glEnable (GL_BLEND);
|
||||||
|
theCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
// alpha to coverage makes text too thin
|
// alpha to coverage makes text too thin
|
||||||
theCtx->SetSampleAlphaToCoverage (false);
|
theCtx->SetSampleAlphaToCoverage (false);
|
||||||
@ -853,8 +856,11 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (theTextAspect.Aspect()->TextDisplayType() == Aspect_TODT_DIMENSION)
|
if (theTextAspect.Aspect()->TextDisplayType() == Aspect_TODT_DIMENSION)
|
||||||
|
{
|
||||||
|
if (theTextAspect.Aspect()->AlphaMode() == Graphic3d_AlphaMode_MaskBlend)
|
||||||
{
|
{
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
|
}
|
||||||
if (!myIs2d)
|
if (!myIs2d)
|
||||||
{
|
{
|
||||||
glDisable (GL_DEPTH_TEST);
|
glDisable (GL_DEPTH_TEST);
|
||||||
@ -880,7 +886,10 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset OpenGL state
|
// reset OpenGL state
|
||||||
glDisable (GL_BLEND);
|
if (theTextAspect.Aspect()->AlphaMode() == Graphic3d_AlphaMode_MaskBlend)
|
||||||
|
{
|
||||||
|
theCtx->core11fwd->glDisable (GL_BLEND);
|
||||||
|
}
|
||||||
glDisable (GL_STENCIL_TEST);
|
glDisable (GL_STENCIL_TEST);
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
glDisable (GL_COLOR_LOGIC_OP);
|
glDisable (GL_COLOR_LOGIC_OP);
|
||||||
|
@ -261,6 +261,7 @@ const OpenGl_Aspects* OpenGl_Workspace::ApplyAspects (bool theToBindTextures)
|
|||||||
if (myAspectsSet->Aspect()->InteriorStyle() == Aspect_IS_HATCH
|
if (myAspectsSet->Aspect()->InteriorStyle() == Aspect_IS_HATCH
|
||||||
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Blend
|
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Blend
|
||||||
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Mask
|
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Mask
|
||||||
|
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_MaskBlend
|
||||||
|| (myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_BlendAuto
|
|| (myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_BlendAuto
|
||||||
&& myAspectsSet->Aspect()->FrontMaterial().Transparency() != 0.0f))
|
&& myAspectsSet->Aspect()->FrontMaterial().Transparency() != 0.0f))
|
||||||
{
|
{
|
||||||
|
@ -516,6 +516,7 @@ void RWGltf_GltfMaterialMap::DefineMaterial (const XCAFPrs_Style& theStyle,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Graphic3d_AlphaMode_Blend:
|
case Graphic3d_AlphaMode_Blend:
|
||||||
|
case Graphic3d_AlphaMode_MaskBlend:
|
||||||
{
|
{
|
||||||
myWriter->Key ("alphaMode");
|
myWriter->Key ("alphaMode");
|
||||||
myWriter->String ("BLEND");
|
myWriter->String ("BLEND");
|
||||||
|
@ -2552,6 +2552,11 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
aChangeSet->AlphaMode = Graphic3d_AlphaMode_Blend;
|
aChangeSet->AlphaMode = Graphic3d_AlphaMode_Blend;
|
||||||
}
|
}
|
||||||
|
else if (aParam == "maskblend"
|
||||||
|
|| aParam == "blendmask")
|
||||||
|
{
|
||||||
|
aChangeSet->AlphaMode = Graphic3d_AlphaMode_MaskBlend;
|
||||||
|
}
|
||||||
else if (aParam == "blendauto"
|
else if (aParam == "blendauto"
|
||||||
|| aParam == "auto")
|
|| aParam == "auto")
|
||||||
{
|
{
|
||||||
@ -6689,7 +6694,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: [-faceBoundaryWidth LineWidth] [-faceBoundaryColor R G B] [-faceBoundaryType LineType]"
|
"\n\t\t: [-faceBoundaryWidth LineWidth] [-faceBoundaryColor R G B] [-faceBoundaryType LineType]"
|
||||||
"\n\t\t: [-drawEdges {0|1}] [-edgeType LineType] [-edgeColor R G B] [-quadEdges {0|1}]"
|
"\n\t\t: [-drawEdges {0|1}] [-edgeType LineType] [-edgeColor R G B] [-quadEdges {0|1}]"
|
||||||
"\n\t\t: [-drawSilhouette {0|1}]"
|
"\n\t\t: [-drawSilhouette {0|1}]"
|
||||||
"\n\t\t: [-alphaMode {opaque|mask|blend|blendauto} [alphaCutOff=0.5]]"
|
"\n\t\t: [-alphaMode {opaque|mask|blend|maskblend|blendauto} [alphaCutOff=0.5]]"
|
||||||
"\n\t\t: [-dumpJson]"
|
"\n\t\t: [-dumpJson]"
|
||||||
"\n\t\t: [-dumpCompact {0|1}]"
|
"\n\t\t: [-dumpCompact {0|1}]"
|
||||||
"\n\t\t: [-dumpDepth depth]"
|
"\n\t\t: [-dumpDepth depth]"
|
||||||
|
@ -9640,6 +9640,11 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
|||||||
{
|
{
|
||||||
aMode = Graphic3d_AlphaMode_Blend;
|
aMode = Graphic3d_AlphaMode_Blend;
|
||||||
}
|
}
|
||||||
|
else if (aValStr == "maskblend"
|
||||||
|
|| aValStr == "blendmask")
|
||||||
|
{
|
||||||
|
aMode = Graphic3d_AlphaMode_MaskBlend;
|
||||||
|
}
|
||||||
else if (aValStr == "blendauto")
|
else if (aValStr == "blendauto")
|
||||||
{
|
{
|
||||||
aMode = Graphic3d_AlphaMode_BlendAuto;
|
aMode = Graphic3d_AlphaMode_BlendAuto;
|
||||||
|
@ -87,6 +87,7 @@ static const char* alphaModeToString (Graphic3d_AlphaMode theMode)
|
|||||||
case Graphic3d_AlphaMode_Opaque: return "Opaque";
|
case Graphic3d_AlphaMode_Opaque: return "Opaque";
|
||||||
case Graphic3d_AlphaMode_Mask: return "Mask";
|
case Graphic3d_AlphaMode_Mask: return "Mask";
|
||||||
case Graphic3d_AlphaMode_Blend: return "Blend";
|
case Graphic3d_AlphaMode_Blend: return "Blend";
|
||||||
|
case Graphic3d_AlphaMode_MaskBlend: return "MaskBlend";
|
||||||
case Graphic3d_AlphaMode_BlendAuto: return "BlendAuto";
|
case Graphic3d_AlphaMode_BlendAuto: return "BlendAuto";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@ -986,6 +987,11 @@ static Standard_Integer XAddVisMaterial (Draw_Interpretor& , Standard_Integer th
|
|||||||
{
|
{
|
||||||
anAlphaMode = Graphic3d_AlphaMode_Blend;
|
anAlphaMode = Graphic3d_AlphaMode_Blend;
|
||||||
}
|
}
|
||||||
|
else if (aModeStr == "maskblend"
|
||||||
|
|| aModeStr == "blendmask")
|
||||||
|
{
|
||||||
|
anAlphaMode = Graphic3d_AlphaMode_MaskBlend;
|
||||||
|
}
|
||||||
else if (aModeStr == "blendauto")
|
else if (aModeStr == "blendauto")
|
||||||
{
|
{
|
||||||
anAlphaMode = Graphic3d_AlphaMode_BlendAuto;
|
anAlphaMode = Graphic3d_AlphaMode_BlendAuto;
|
||||||
|
@ -51,6 +51,7 @@ static const char* alphaModeToString (Graphic3d_AlphaMode theMode)
|
|||||||
case Graphic3d_AlphaMode_Opaque: return "Opaque";
|
case Graphic3d_AlphaMode_Opaque: return "Opaque";
|
||||||
case Graphic3d_AlphaMode_Mask: return "Mask";
|
case Graphic3d_AlphaMode_Mask: return "Mask";
|
||||||
case Graphic3d_AlphaMode_Blend: return "Blend";
|
case Graphic3d_AlphaMode_Blend: return "Blend";
|
||||||
|
case Graphic3d_AlphaMode_MaskBlend: return "MaskBlend";
|
||||||
case Graphic3d_AlphaMode_BlendAuto: return "Auto";
|
case Graphic3d_AlphaMode_BlendAuto: return "Auto";
|
||||||
}
|
}
|
||||||
return "Auto";
|
return "Auto";
|
||||||
@ -59,12 +60,25 @@ static const char* alphaModeToString (Graphic3d_AlphaMode theMode)
|
|||||||
//! Decode alpha mode from string.
|
//! Decode alpha mode from string.
|
||||||
static Graphic3d_AlphaMode alphaModeFromString (const char* theMode)
|
static Graphic3d_AlphaMode alphaModeFromString (const char* theMode)
|
||||||
{
|
{
|
||||||
switch (*theMode)
|
if (strcasecmp (theMode, "Opaque") == 0)
|
||||||
{
|
{
|
||||||
case 'O': return Graphic3d_AlphaMode_Opaque;
|
return Graphic3d_AlphaMode_Opaque;
|
||||||
case 'M': return Graphic3d_AlphaMode_Mask;
|
}
|
||||||
case 'B': return Graphic3d_AlphaMode_Blend;
|
else if (strcasecmp (theMode, "Mask") == 0)
|
||||||
case 'A': return Graphic3d_AlphaMode_BlendAuto;
|
{
|
||||||
|
return Graphic3d_AlphaMode_Mask;
|
||||||
|
}
|
||||||
|
else if (strcasecmp (theMode, "Blend") == 0)
|
||||||
|
{
|
||||||
|
return Graphic3d_AlphaMode_Blend;
|
||||||
|
}
|
||||||
|
else if (strcasecmp (theMode, "MaskBlend") == 0)
|
||||||
|
{
|
||||||
|
return Graphic3d_AlphaMode_MaskBlend;
|
||||||
|
}
|
||||||
|
else if (strcasecmp (theMode, "Auto") == 0)
|
||||||
|
{
|
||||||
|
return Graphic3d_AlphaMode_BlendAuto;
|
||||||
}
|
}
|
||||||
return Graphic3d_AlphaMode_BlendAuto;
|
return Graphic3d_AlphaMode_BlendAuto;
|
||||||
}
|
}
|
||||||
|
25
tests/bugs/vis/bug32143
Normal file
25
tests/bugs/vis/bug32143
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "0032143: Visualization - add option excluding transparent object from sorting"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload MODELING VISUALIZATION
|
||||||
|
vclear
|
||||||
|
vinit View1 -width 512 -height 512
|
||||||
|
vbackground -gradient GRAY20 GRAY80
|
||||||
|
restore [locate_data_file Ball.brep] b
|
||||||
|
vdisplay -dispMode 1 b
|
||||||
|
vfit
|
||||||
|
|
||||||
|
set dx 220; set dy 74
|
||||||
|
set logoPath "$::env(CSF_OCCTResourcePath)/DrawResources/OCC_logo.png"
|
||||||
|
box logo $dx $dy 0 -preview
|
||||||
|
vdisplay -dispMode 1 logo -topmost -2d bottomRight [expr $dx+25] 25
|
||||||
|
vtexture logo "$logoPath"
|
||||||
|
vaspects logo -alphaMode BLEND -shadingModel UNLIT
|
||||||
|
vdisplay logo -underlay
|
||||||
|
if { [vreadpixel 320 440 -rgb -name] != "DEEPSKYBLUE3" } { puts "Error: Unexpected color for BLEND" }
|
||||||
|
vaspects logo -alphaMode MASKBLEND 0.001 -shadingModel UNLIT
|
||||||
|
if { [vreadpixel 320 440 -rgb -name] != "DARKGOLDENROD" } { puts "Error: Unexpected color for MASKBLEND" }
|
||||||
|
|
||||||
|
vdump ${imagedir}/${casename}.png
|
Loading…
x
Reference in New Issue
Block a user