0027860: Visualization - clean up Transformation Persistence API
[occt.git] / src / Graphic3d / Graphic3d_ArrayOfPrimitives.lxx
index bf7f77e..4661b9b 100644 (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)
@@ -167,12 +175,18 @@ inline void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer
   {
     Graphic3d_Vec4ub aColor (Standard_Byte(theR * 255.0),
                              Standard_Byte(theG * 255.0),
-                             Standard_Byte(theB * 255.0), 0);
+                             Standard_Byte(theB * 255.0), 255);
     SetVertexColor (theIndex, *reinterpret_cast<Standard_Integer*>(&aColor));
   }
   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,
@@ -288,7 +302,7 @@ inline void Graphic3d_ArrayOfPrimitives::VertexColor (const Standard_Integer the
   }
   Standard_Integer aColorInt = 0;
   VertexColor (theIndex, aColorInt);
-  const Graphic3d_Vec4ub& aColor = *reinterpret_cast<const Graphic3d_Vec4ub* >(aColorInt);
+  const Graphic3d_Vec4ub& aColor = *reinterpret_cast<const Graphic3d_Vec4ub* >(&aColorInt);
   theR = Standard_Real(aColor.r()) / 255.0;
   theG = Standard_Real(aColor.g()) / 255.0;
   theB = Standard_Real(aColor.b()) / 255.0;