1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027655: Visualization - AIS_Triangulation disappears after setting non-zero transparency

Add a new methods in AIS_Triangulation: SetTransparency, UnsetTransparency, HasVertexColor, updatePresentation.
Add a new methods in Graphic3d_ArrayOfPrimitives: AddVertex(gp_Pnt, Graphic3d_Vec4ub) and SetVertexColor(Standard_Integer, Graphic3d_Vec4ub).
Type of color of array in AIS_Triangulation is Graphic3d_Vec4ub now.
This commit is contained in:
isk
2016-06-30 15:25:43 +03:00
committed by bugmaster
parent caee72a96e
commit dcc1741921
6 changed files with 163 additions and 41 deletions

View File

@@ -97,6 +97,13 @@ Standard_Integer AddVertex (const Graphic3d_Vec3& theVertex);
//! On all architecture proccers type (x86 or SPARC) you can
//! use this byte order.
Standard_EXPORT Standard_Integer AddVertex (const gp_Pnt& aVertice, const Standard_Integer aColor);
//! Adds a vertice and vertex color in the vertex array.
//! returns the actual vertex number.
//! Warning: <theColor> is ignored when the <hasVColors>
//! constructor parameter is FALSE
Standard_Integer AddVertex (const gp_Pnt& theVertex,
const Graphic3d_Vec4ub& theColor);
//! Adds a vertice and vertex normal in the vertex array.
//! returns the actual vertex number.
@@ -210,6 +217,10 @@ Standard_Integer AddVertex (const Graphic3d_Vec3& theVertex);
//! Change the vertex color of rank <anIndex> in the array.
void SetVertexColor (const Standard_Integer anIndex, const Standard_Real R, const Standard_Real G, const Standard_Real B);
//! Change the vertex color of rank <theIndex> in the array.
void SetVertexColor (const Standard_Integer theIndex,
const Graphic3d_Vec4ub& theColor);
//! Change the vertex color of rank <anIndex> in the array.
//! aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red

View File

@@ -68,6 +68,14 @@ inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Graphic3d_
return AddVertex (theVertex.x(), theVertex.y(), theVertex.z());
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const Graphic3d_Vec4ub& theColor)
{
const Standard_Integer anIndex = AddVertex (theVertex);
SetVertexColor (anIndex, theColor);
return anIndex;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX,
const Standard_Real theY,
const Standard_Real theZ)
@@ -173,6 +181,12 @@ inline void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer
myAttribs->NbElements = Max (theIndex, myAttribs->NbElements);
}
inline void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer theIndex,
const Graphic3d_Vec4ub& theColor)
{
SetVertexColor (theIndex, *reinterpret_cast<const Standard_Integer*> (&theColor));
}
inline void Graphic3d_ArrayOfPrimitives::SetVertexNormal (const Standard_Integer theIndex,
const Standard_Real theNX,
const Standard_Real theNY,