0030574: Configuration, genproj - CSF_DEFINES is not reset at the beginning of env.bat
[occt.git] / dox / dev_guides / upgrade / upgrade.md
index 0b9cdf8..1846d04 100644 (file)
@@ -1678,3 +1678,68 @@ Standard_Boolean meshing_new()
 Some public methods of the class BRepFilletAPI_MakeChamfer are released from excess arguments:
 - method Add for symmetric chamfer now takes only 2 arguments: distance and edge;
 - method GetDistAngle now takes only 3 arguments: index of contour, distance and angle.
+
+@subsection upgrade_740_aspects Aspects unification
+
+Fill Area, Line and Marker aspects (classes *Graphic3d_AspectFillArea3d*, *Graphic3d_AspectLine3d*, *Graphic3d_AspectMarker3d* and *Graphic3d_AspectText3d*)
+have been merged into new class *Graphic3d_Aspects* providing a single state for rendering primitives of any type.
+The old per-primitive type aspect classes have been preserved as sub-classes of *Graphic3d_Aspects* with default values close to the previous behavior.
+All aspects except Graphic3d_AspectFillArea3d define Graphic3d_TOSM_UNLIT shading model.
+
+The previous approach with dedicated aspects per primitive type was handy in simplified case, but lead to confusion otherwise.
+In fact, drawing points or lines with lighting applied is a valid use case, but only *Graphic3d_AspectFillArea3d* previously defined necessary material properties.
+
+As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties.
+Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated.
+For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property:
+~~~~
+Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
+aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
+aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());    //!< overrides previous aspect
+
+Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
+Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
+aGroup->AddPrimitiveArray (aLines); //!< both arrays will use the same aspect
+aGroup->AddPrimitiveArray (aTris);
+~~~~
+
+To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order:
+~~~~
+Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
+
+aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
+Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
+aGroup->AddPrimitiveArray (aTris);
+
+Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
+aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array will use the new aspect
+aGroup->AddPrimitiveArray (aLines);
+~~~~
+
+@subsection upgrade_740_prsupdate Presentation invalidation
+
+Historically AIS_InteractiveObject provided two independent mechanisms invalidating presentation (asking presentation manager to recompute specific display mode or all modes):
+
+1. *AIS_InteractiveObject::SetToUpdate()*, marking existing presentation for update.
+   This is main invalidation API, which is expected to be followed by *AIS_InteractiveContext::Update()* call.
+2. *AIS_InteractiveObject::myToRecomputeModes* + *myRecomputeEveryPrs*.
+   This is auxiliary invalidation API, used internally by AIS_InteractiveContext::SetColor()/UnsetColor() and similar modification methods.
+
+The latter one has been removed to avoid confusion and unexpected behavior.
+In addition, two methods *AIS_InteractiveObject::Update()* have been deprecated in favor of new *AIS_InteractiveObject::UpdatePresentations()* recomputing only invalidated presentations.
+
+Custom presentations implementing interface methods *AIS_InteractiveObject::SetColor()* and others should be revised to use *AIS_InteractiveObject::SetToUpdate()*
+or updating presentation without recomputation (see *AIS_InteractiveObject::SynchronizeAspects()* and *AIS_InteractiveObject::replaceAspects()*).
+
+@subsection upgrade_740_interiorstyles Interior styles
+
+* *Aspect_IS_HOLLOW* is now an alias to *Aspect_IS_EMPTY* and does not implicitly enables drawing mesh edges anymore.
+  Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_EMPTY) to get previous behavior of Aspect_IS_HOLLOW style.
+* *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
+  Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
+
+@subsection upgrade_740_geproj Custom defines within env.bat
+
+*env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state.
+Custom building environment relying on old behavior and setting extra macros within *%CSF_DEFINES%* before env.bat should be updated
+to either modify custom.bat or setup new variable *%CSF_DEFINES_EXTRA%* instead.