Solids with mirror location are displayed, according to their normals.
vaspects -setBackFaceColor, added command to set backface color.
aPoint = aNodes (aNodeIter);
const Standard_Integer anId = 3 * (aNodeIter - aNodes.Lower());
gp_Dir aNorm (aNormArr[anId + 0], aNormArr[anId + 1], aNormArr[anId + 2]);
- if (aFace.Orientation() == TopAbs_REVERSED)
+ if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
{
aNorm.Reverse();
}
Standard_Integer anIndex[3];
for (Standard_Integer aTriIter = 1; aTriIter <= aT->NbTriangles(); ++aTriIter)
{
- if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
+ if ((aFace.Orientation() == TopAbs_REVERSED))
{
aTriangles (aTriIter).Get (anIndex[0], anIndex[2], anIndex[1]);
}
Standard_Integer ToSetColor;
Quantity_Color Color;
+ Standard_Integer ToSetBackFaceColor;
+ Quantity_Color BackFaceColor;
Standard_Integer ToSetLineWidth;
Standard_Real LineWidth;
Visibility (1),
ToSetColor (0),
Color (DEFAULT_COLOR),
+ ToSetBackFaceColor(0),
+ BackFaceColor (DEFAULT_COLOR),
ToSetLineWidth (0),
LineWidth (1.0),
ToSetTypeOfLine (0),
&& ToSetTransparency == 0
&& ToSetAlphaMode == 0
&& ToSetColor == 0
+ && ToSetBackFaceColor == 0
&& ToSetMaterial == 0
&& ToSetShowFreeBoundary == 0
&& ToSetFreeBoundaryColor == 0
theDrawer->ShadingAspect()->Aspect()->SetShadingModel (ShadingModel);
}
}
+ if (ToSetBackFaceColor != 0)
+ {
+ if (ToSetBackFaceColor != -1
+ || theDrawer->HasOwnShadingAspect())
+ {
+ toRecompute = theDrawer->SetupOwnShadingAspect (aDefDrawer) || toRecompute;
+ theDrawer->ShadingAspect()->SetColor (BackFaceColor, Aspect_TOFM_BACK_SIDE);
+ }
+ }
if (ToSetAlphaMode != 0)
{
if (ToSetAlphaMode != -1
}
else if (anArg == "-setcolor"
|| anArg == "-color"
+ || anArg == "-setbackfacecolor"
+ || anArg == "-backfacecolor"
+ || anArg == "-setbackcolor"
+ || anArg == "-backcolor"
|| anArg == "-setfaceboundarycolor"
|| anArg == "-setboundarycolor"
|| anArg == "-faceboundarycolor"
aChangeSet->ToSetFaceBoundaryColor = 1;
aChangeSet->FaceBoundaryColor = aColor;
}
+ else if (anArg == "-setbackfacecolor"
+ || anArg == "-backfacecolor"
+ || anArg == "-setbackcolor"
+ || anArg == "-backcolor")
+ {
+ aChangeSet->ToSetBackFaceColor = 1;
+ aChangeSet->BackFaceColor = aColor;
+ }
else
{
aChangeSet->ToSetColor = 1;
aChangeSet->AlphaCutoff = 0.5f;
aChangeSet->ToSetColor = -1;
aChangeSet->Color = DEFAULT_COLOR;
+ //aChangeSet->ToSetBackFaceColor = -1; // should be reset by ToSetColor
+ //aChangeSet->BackFaceColor = DEFAULT_COLOR;
aChangeSet->ToSetMaterial = -1;
aChangeSet->Material = Graphic3d_NOM_DEFAULT;
aChangeSet->ToSetShowFreeBoundary = -1;
"vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]"
"\n\t\t: [-setVisibility 0|1]"
"\n\t\t: [-setColor ColorName] [-setcolor R G B] [-unsetColor]"
+ "\n\t\t: [-setBackFaceColor Color]"
"\n\t\t: [-setMaterial MatName] [-unsetMaterial]"
"\n\t\t: [-setTransparency Transp] [-unsetTransparency]"
"\n\t\t: [-setWidth LineWidth] [-unsetWidth]"
--- /dev/null
+puts "=================================================================================="
+puts "0030630: Visualization - wrong visualization of shape with mirrored transformation"
+puts "Check that displaying of non-solid shapes (shells) is not affected by mirror transformation"
+puts "=================================================================================="
+
+pload MODELING VISUALIZATION
+vclear
+vinit View1
+vaxo
+vrotate 3 0 0
+vcamera -persp
+
+# Simple box
+box b 1 1 1
+explode b sh
+renamevar b_1 b
+vdisplay -dispMode 1 b
+vaspects b -setBackFaceColor RED
+vfit
+vdump $imagedir/${casename}_simple.png
+verase b
+
+# Box with mirror transformation
+box a 1 1 1
+bmirror a 0 0 0 1 0 0
+explode a sh
+renamevar a_1 a
+vdisplay -dispMode 1 a
+vaspects a -setBackFaceColor RED
+vfit
+box aa -0.5 0.5 0.5 0.1 0.1 0.1
+vdisplay -dispMode 1 aa
+vsetcolor aa BLUE1
+vdump $imagedir/${casename}_mirror.png
+if { [vreadpixel 300 200 rgb name] != "RED2" } { puts "Error: shell of mirrored box should show back faces" }
+verase a
+
+# Box with mirror transformation and reversed face
+box c 1 1 1
+bmirror c 0 0 0 1 0 0
+orientation c R
+explode c sh
+renamevar c_1 c
+vdisplay -dispMode 1 c
+vaspects c -setBackFaceColor RED
+vfit
+vdump $imagedir/${casename}_mirrev.png
+if { [vreadpixel 300 200 rgb name] == "RED2" } { puts "Error: shell of reversed mirrored box should show front faces" }
--- /dev/null
+puts "=================================================================================="
+puts "0030630: Visualization - wrong visualization of shape with mirrored transformation"
+puts "Check that local transformation of visualizated object"
+puts "affects only position, not material place"
+puts "=================================================================================="
+
+pload MODELING VISUALIZATION
+vclear
+vinit View1
+vaxo
+vrotate 3 0 0
+vcamera -persp
+
+# Simple box
+box b 1 1 1
+bmirror b 0 0 0 0 0 1
+vdisplay -dispMode 1 b
+vaspects b -setBackFaceColor RED
+box bb 0.5 0.5 -0.5 0.1 0.1 0.1
+vdisplay -dispMode 1 bb
+vsetcolor bb BLUE1
+vfit
+vdump $imagedir/${casename}_simple.png
+if { [vreadpixel 195 220 rgb name] != "BLUE2" } { puts "Error: mirrored box should look inside out" }
+
+# Box with rotation transformation
+vlocation b -rotate 0 0 0 1 0 0 90
+vlocation bb -rotate 0 0 0 1 0 0 90
+vfit
+vdump $imagedir/${casename}_rotate.png
+if { [vreadpixel 215 230 rgb name] != "BLUE2" } { puts "Error: rotated mirrored box should look inside out" }
+
+# Box with mirror transformation
+vlocation b -reset
+vlocation b -mirror 0 -0.5 0 0 1 0
+vlocation bb -reset
+vlocation bb -mirror 0 -0.5 0 0 1 0
+vfit
+vdump $imagedir/${casename}_mirror.png
+if { [vreadpixel 215 230 rgb name] != "BLUE2" } { puts "Error: mirrored mirrored box should look inside out" }
--- /dev/null
+puts "=================================================================================="
+puts "0030630: Visualization - wrong visualization of shape with mirrored transformation"
+puts "Check that solid with mirrored transformation is displayed as turned out"
+puts "=================================================================================="
+
+pload MODELING VISUALIZATION
+vclear
+vinit View1
+vaxo
+vrotate 3 0 0
+vcamera -persp
+
+# Simple box
+box b 1 1 1
+vdisplay -dispMode 1 b
+vaspects b -setBackFaceColor RED
+vfit
+vdump $imagedir/${casename}_simple.png
+verase b
+
+# Box with mirror transformation
+box a 1 1 1
+bmirror a 0 0 0 1 0 0
+vdisplay -dispMode 1 a
+vaspects a -setBackFaceColor RED
+vfit
+box aa -0.5 0.5 0.5 0.1 0.1 0.1
+vdisplay -dispMode 1 aa
+vsetcolor aa BLUE1
+vdump $imagedir/${casename}_mirror.png
+if { [vreadpixel 195 220 rgb name] != "BLUE2" } { puts "Error: mirrored box should look inside out" }
+verase a
+
+# Box with mirror transformation and reversed face
+box c 1 1 1
+bmirror c 0 0 0 1 0 0
+orientation c R
+vdisplay -dispMode 1 c
+vaspects c -setBackFaceColor RED
+vfit
+vdump $imagedir/${casename}_mirrev.png
+if { [vreadpixel 195 220 rgb name] == "BLUE2" } { puts "Error: revered mirrored box should NOT look inside out" }