//
// This file is part of Open CASCADE Technology software library.
//
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// =======================================================================
void OpenGl_AspectMarker::SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect)
{
- myColor.rgb[0] = (float )theAspect.Color.r;
- myColor.rgb[1] = (float )theAspect.Color.g;
- myColor.rgb[2] = (float )theAspect.Color.b;
- myColor.rgb[3] = 1.0f;
- myMarkerImage = theAspect.MarkerImage;
- myType = theAspect.MarkerType;
- myScale = myMarkerSize = theAspect.Scale;
+ myColor.rgb[0] = (float )theAspect.Color.r;
+ myColor.rgb[1] = (float )theAspect.Color.g;
+ myColor.rgb[2] = (float )theAspect.Color.b;
+ myColor.rgb[3] = 1.0f;
+ myMarkerImage = theAspect.MarkerImage;
+ myType = theAspect.MarkerType;
+ myScale = theAspect.Scale;
myShaderProgram = theAspect.ShaderProgram;
// update sprite resource bindings
TCollection_AsciiString aSpriteAKey = THE_EMPTY_KEY;
myResources.SpriteKeys (myMarkerImage, myType, myScale, myColor, aSpriteKey, aSpriteAKey);
- if (aSpriteKey.IsEmpty() || myResources.SpriteKey != aSpriteKey)
- {
- myResources.ResetSpriteReadiness();
- }
- if (aSpriteAKey.IsEmpty() || myResources.SpriteAKey != aSpriteAKey)
+ if (aSpriteKey.IsEmpty() || myResources.SpriteKey != aSpriteKey
+ || aSpriteAKey.IsEmpty() || myResources.SpriteAKey != aSpriteAKey)
{
myResources.ResetSpriteReadiness();
+ myMarkerSize = theAspect.Scale;
}
// update shader program resource bindings
// function : Release
// purpose :
// =======================================================================
-void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx)
+void OpenGl_AspectMarker::Release (OpenGl_Context* theCtx)
{
if (!myResources.Sprite.IsNull())
{
- if (!theCtx.IsNull())
+ if (theCtx)
{
if (myResources.SpriteKey.IsEmpty())
{
myResources.SpriteAKey.Clear();
myResources.ResetSpriteReadiness();
- if (!myResources.ShaderProgram.IsNull() && !theCtx.IsNull())
+ if (!myResources.ShaderProgram.IsNull() && theCtx)
{
theCtx->ShaderManager()->Unregister (myResources.ShaderProgramId,
myResources.ShaderProgram);
anImageA = new Image_PixMap();
anImage ->InitZero (Image_PixMap::ImgBGRA, aSize, aSize);
anImageA->InitZero (Image_PixMap::ImgGray, aSize, aSize);
- Image_PixMapData<Image_ColorBGRA>& aDataBGRA = anImage->EditData<Image_ColorBGRA>();
- Image_PixMapData<Standard_Byte>& aDataGray = anImageA->EditData<Standard_Byte>();
// we draw a set of circles
Image_ColorBGRA aColor32;
const Handle(Graphic3d_MarkerImage) aMarker = GetTextureImage (Aspect_TOM_O, aScale);
const Handle(Image_PixMap)& aCircle = aMarker->GetImage();
- const Standard_Size aDiffX = (aDataBGRA.SizeX() - aCircle->SizeX()) / 2;
- const Standard_Size aDiffY = (aDataBGRA.SizeY() - aCircle->SizeY()) / 2;
+ const Standard_Size aDiffX = (anImage->SizeX() - aCircle->SizeX()) / 2;
+ const Standard_Size aDiffY = (anImage->SizeY() - aCircle->SizeY()) / 2;
for (Standard_Size aRow = 0; aRow < aCircle->SizeY(); ++aRow)
{
const Standard_Byte* aRowData = aCircle->Row (aRow);
{
if (aRowData[aCol] != 0)
{
- aDataBGRA.ChangeValue (aDiffX + aRow, aDiffY + aCol) = aColor32;
- aDataGray.ChangeValue (aDiffX + aRow, aDiffY + aCol) = 255;
+ anImage ->ChangeValue<Image_ColorBGRA> (aDiffX + aRow, aDiffY + aCol) = aColor32;
+ anImageA->ChangeValue<Standard_Byte> (aDiffX + aRow, aDiffY + aCol) = 255;
}
}
}