mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024131: TKOpenGL redesign GPU memory management for markers presentation
Introduce Point Sprites usage. Graphic3d_Group - drop Marker(),MarkerSet() methods - markers should be drawn using AddPrimitiveArray. Added new Draw Harness commands vcaps, vmarkerstest.
This commit is contained in:
@@ -30,7 +30,6 @@ Graphic3d_Structure.pxx
|
||||
Graphic3d_Group.pxx
|
||||
Graphic3d_Group_1.cxx
|
||||
Graphic3d_Group_2.cxx
|
||||
Graphic3d_Group_3.cxx
|
||||
Graphic3d_Group_8.cxx
|
||||
Graphic3d_Group_10.cxx
|
||||
Graphic3d_Structure.pxx
|
||||
@@ -53,3 +52,6 @@ Graphic3d_Vec3.hxx
|
||||
Graphic3d_Vec4.hxx
|
||||
Graphic3d_Vertex.hxx
|
||||
Graphic3d_Vertex.cxx
|
||||
Graphic3d_MarkerImage.hxx
|
||||
Graphic3d_MarkerImage.cxx
|
||||
Graphic3d_MarkerImage_Handle.hxx
|
@@ -215,7 +215,8 @@ is
|
||||
enumeration TypeOfTextureMode is TOTM_OBJECT,
|
||||
TOTM_SPHERE,
|
||||
TOTM_EYE,
|
||||
TOTM_MANUAL;
|
||||
TOTM_MANUAL,
|
||||
TOTM_SPRITE;
|
||||
---Purpose: Type of the texture projection.
|
||||
---Category: Enumerations
|
||||
|
||||
@@ -402,6 +403,9 @@ is
|
||||
|
||||
imported CTransPersStruct;
|
||||
imported TransModeFlags;
|
||||
|
||||
imported MarkerImage;
|
||||
imported MarkerImage_Handle;
|
||||
|
||||
primitive PtrFrameBuffer;
|
||||
primitive Vec2;
|
||||
|
@@ -21,13 +21,13 @@ class ArrayOfPoints from Graphic3d inherits ArrayOfPrimitives from Graphic3d
|
||||
|
||||
is
|
||||
|
||||
-- constructor
|
||||
Create (
|
||||
maxVertexs: Integer from Standard)
|
||||
returns mutable ArrayOfPoints from Graphic3d;
|
||||
---Purpose: Creates an array of points,
|
||||
-- a single pixel point is drawn at each vertex.
|
||||
-- The array must be filled using only
|
||||
-- the AddVertex(Point) method.
|
||||
-- constructor
|
||||
Create (maxVertexs: Integer from Standard;
|
||||
hasVColors: Boolean from Standard = Standard_False)
|
||||
returns mutable ArrayOfPoints from Graphic3d;
|
||||
---Purpose: Creates an array of points,
|
||||
-- a single pixel point is drawn at each vertex.
|
||||
-- The array must be filled using the AddVertex(Point) method.
|
||||
-- When <hasVColors> is TRUE , you must use only AddVertex(Point,Color) method.
|
||||
|
||||
end;
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <Graphic3d_ArrayOfPoints.ixx>
|
||||
|
||||
Graphic3d_ArrayOfPoints :: Graphic3d_ArrayOfPoints (
|
||||
const Standard_Integer maxVertexs)
|
||||
: Graphic3d_ArrayOfPrimitives(Graphic3d_TOPA_POINTS,maxVertexs,0,0,Standard_False,Standard_False,Standard_False,Standard_False,Standard_False) {}
|
||||
Graphic3d_ArrayOfPoints :: Graphic3d_ArrayOfPoints (const Standard_Integer maxVertexs,
|
||||
const Standard_Boolean hasVColors)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POINTS, maxVertexs, 0, 0, Standard_False, hasVColors, Standard_False, Standard_False, Standard_False)
|
||||
{}
|
||||
|
@@ -20,88 +20,89 @@
|
||||
|
||||
class AspectMarker3d from Graphic3d inherits AspectMarker from Aspect
|
||||
|
||||
---Version:
|
||||
---Version:
|
||||
|
||||
---Purpose: Creates and updates an attribute group for
|
||||
-- marker type primitives. This group contains the type
|
||||
-- of marker, its colour, and its scale factor.
|
||||
---Keywords: Marker, Color, Scale, Type
|
||||
---Purpose: Creates and updates an attribute group for
|
||||
-- marker type primitives. This group contains the type
|
||||
-- of marker, its colour, and its scale factor.
|
||||
---Keywords: Marker, Color, Scale, Type
|
||||
|
||||
---Warning:
|
||||
---References:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
|
||||
TypeOfMarker from Aspect,
|
||||
|
||||
HArray1OfByte from TColStd
|
||||
Color from Quantity,
|
||||
TypeOfMarker from Aspect,
|
||||
HArray1OfByte from TColStd,
|
||||
PixMap_Handle from Image,
|
||||
MarkerImage_Handle from Graphic3d
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a context table for marker primitives
|
||||
-- defined with the following default values:
|
||||
--
|
||||
-- Marker type : TOM_X
|
||||
-- Colour : YELLOW
|
||||
-- Scale factor : 1.0
|
||||
|
||||
Create ( AType : TypeOfMarker from Aspect;
|
||||
AColor : Color from Quantity;
|
||||
AScaleOrId : Real from Standard
|
||||
)
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
Create
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a context table for marker primitives
|
||||
-- defined with the following default values:
|
||||
--
|
||||
-- Marker type : TOM_X
|
||||
-- Colour : YELLOW
|
||||
-- Scale factor: 1.0
|
||||
|
||||
Create ( AType : TypeOfMarker from Aspect;
|
||||
AColor : Color from Quantity;
|
||||
AScaleOrId : Real from Standard;
|
||||
AWidth : Integer from Standard;
|
||||
AHeight : Integer from Standard;
|
||||
ATexture : HArray1OfByte from TColStd
|
||||
)
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a context table for marker primitives
|
||||
-- defined with the specified values.
|
||||
Create (theType : TypeOfMarker from Aspect;
|
||||
theColor : Color from Quantity;
|
||||
theScale : Real from Standard)
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
|
||||
GetTextureSize (me:mutable; AWidth : out Integer from Standard;
|
||||
AHeight : out Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Returns marker's texture size.
|
||||
Create (theColor : Color from Quantity;
|
||||
theWidth : Integer from Standard;
|
||||
theHeight : Integer from Standard;
|
||||
theTextureBitmap : HArray1OfByte from TColStd)
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a context table for marker primitives
|
||||
-- defined with the specified values.
|
||||
|
||||
GetTexture (me:mutable)
|
||||
returns HArray1OfByte from TColStd;
|
||||
---Level: Public
|
||||
---Purpose: Returns marker's texture.
|
||||
---C++: return const &
|
||||
Create (theTextureImage : PixMap_Handle from Image)
|
||||
returns mutable AspectMarker3d from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a context table for marker primitives
|
||||
-- defined with the specified values.
|
||||
|
||||
SetTexture ( me: mutable;
|
||||
AWidth : Integer from Standard;
|
||||
AHeight : Integer from Standard;
|
||||
ATexture : HArray1OfByte from TColStd ) is static;
|
||||
|
||||
--
|
||||
GetTextureSize (me;
|
||||
theWidth : out Integer from Standard;
|
||||
theHeight: out Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Returns marker's texture size.
|
||||
|
||||
GetMarkerImage (me)
|
||||
returns MarkerImage_Handle from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Returns marker's image texture.
|
||||
--- Could be null handle if marker aspect has been initialized as
|
||||
--- default type of marker.
|
||||
---C++: return const &
|
||||
|
||||
SetBitMap (me: mutable;
|
||||
theWidth : Integer from Standard;
|
||||
theHeight : Integer from Standard;
|
||||
theTexture: HArray1OfByte from TColStd ) is static;
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Graphic3d_AspectMarker3d
|
||||
-- Class: Graphic3d_AspectMarker3d
|
||||
--
|
||||
-- Purpose : Declaration of context-specific variables
|
||||
-- for drawing 3d markers.
|
||||
-- Purpose: Declaration of context-specific variables
|
||||
-- for drawing 3d markers.
|
||||
--
|
||||
-- Reminder : A context for drawing 3d markers inherits:
|
||||
-- - the colour
|
||||
-- - the type of marker
|
||||
-- - the scale factor
|
||||
-- defined by AspectMarker.
|
||||
-- Reminder: A context for drawing 3d markers inherits:
|
||||
-- - the colour
|
||||
-- - the type of marker
|
||||
-- - the scale factor
|
||||
-- defined by AspectMarker.
|
||||
|
||||
myMarkerImage : MarkerImage_Handle from Graphic3d is protected;
|
||||
|
||||
MyTexture : HArray1OfByte from TColStd is protected;
|
||||
MyTextureWidth : Integer from Standard is protected;
|
||||
MyTextureHeight : Integer from Standard is protected;
|
||||
|
||||
end AspectMarker3d;
|
||||
|
@@ -17,86 +17,85 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration of variables specific to the context
|
||||
// of trace of markers 3d
|
||||
|
||||
// Rappels Context of trace of markers 3d inherits the context
|
||||
// defined by :
|
||||
// - the color
|
||||
// - the type of marker
|
||||
// - the scale
|
||||
|
||||
//-Warning
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Graphic3d_AspectMarker3d.ixx>
|
||||
#include <TColStd_Array1OfByte.hxx>
|
||||
#include <Image_PixMap.hxx>
|
||||
#include <Graphic3d_MarkerImage.hxx>
|
||||
|
||||
//-Aliases
|
||||
// =======================================================================
|
||||
// function : Graphic3d_AspectMarker3d
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
|
||||
: Aspect_AspectMarker()
|
||||
{}
|
||||
|
||||
//-Global data definitions
|
||||
// =======================================================================
|
||||
// function : Graphic3d_AspectMarker3d
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType,
|
||||
const Quantity_Color& theColor,
|
||||
const Standard_Real theScale)
|
||||
: Aspect_AspectMarker (theColor, theType, theScale)
|
||||
{}
|
||||
|
||||
//-Constructors
|
||||
// =======================================================================
|
||||
// function : Graphic3d_AspectMarker3d
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor,
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight,
|
||||
const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
|
||||
: Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0),
|
||||
myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight))
|
||||
{}
|
||||
|
||||
//-Destructors
|
||||
// =======================================================================
|
||||
// function : Graphic3d_AspectMarker3d
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage)
|
||||
: Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0),
|
||||
myMarkerImage (new Graphic3d_MarkerImage (theTextureImage))
|
||||
{}
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d ()
|
||||
:Aspect_AspectMarker(), MyTextureWidth(0), MyTextureHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker AType, const Quantity_Color& AColor, const Standard_Real AScaleOrId ):
|
||||
Aspect_AspectMarker( AColor, AType, AScaleOrId ), MyTextureWidth(0), MyTextureHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker AType,
|
||||
const Quantity_Color& AColor,
|
||||
const Standard_Real AScaleOrId,
|
||||
const Standard_Integer AWidth,
|
||||
const Standard_Integer AHeight,
|
||||
const Handle(TColStd_HArray1OfByte)& ATexture ):
|
||||
Aspect_AspectMarker( AColor, AType, AScaleOrId ), MyTexture( ATexture ), MyTextureWidth(AWidth), MyTextureHeight(AHeight)
|
||||
// =======================================================================
|
||||
// function : GetTextureSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth,
|
||||
Standard_Integer& theHeight) const
|
||||
{
|
||||
/*for( Standard_Integer aIndex = ATexture.Lower(); aIndex <= ATexture.Upper(); aIndex++ )
|
||||
{
|
||||
MyTexture.SetValue( aIndex, ATexture.Value( aIndex ) );
|
||||
}
|
||||
*/
|
||||
|
||||
if (!myMarkerImage.IsNull())
|
||||
{
|
||||
myMarkerImage->GetTextureSize (theWidth, theHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
theWidth = 0;
|
||||
theHeight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphic3d_AspectMarker3d::GetTextureSize(Standard_Integer& AWidth, Standard_Integer& AHeight)
|
||||
// =======================================================================
|
||||
// function : GetMarkerImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const
|
||||
{
|
||||
AWidth = MyTextureWidth;
|
||||
AHeight = MyTextureHeight;
|
||||
return myMarkerImage;
|
||||
}
|
||||
|
||||
const Handle(TColStd_HArray1OfByte)& Graphic3d_AspectMarker3d::GetTexture()
|
||||
// =======================================================================
|
||||
// function : SetBitMap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight,
|
||||
const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
|
||||
{
|
||||
return MyTexture;
|
||||
}
|
||||
|
||||
void Graphic3d_AspectMarker3d::SetTexture (const Standard_Integer AWidth,
|
||||
const Standard_Integer AHeight,
|
||||
const Handle(TColStd_HArray1OfByte)& ATexture )
|
||||
{
|
||||
MyTextureWidth = AWidth;
|
||||
MyTextureHeight = AHeight;
|
||||
|
||||
MyTexture = ATexture;
|
||||
myMarkerImage.Nullify();
|
||||
myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight);
|
||||
}
|
||||
|
@@ -19,8 +19,10 @@
|
||||
#ifndef _Graphic3d_CGroup_HeaderFile
|
||||
#define _Graphic3d_CGroup_HeaderFile
|
||||
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
#include <Graphic3d_CTexture.hxx>
|
||||
#include <Graphic3d_MarkerImage_Handle.hxx>
|
||||
|
||||
class Graphic3d_CStructure;
|
||||
|
||||
@@ -80,6 +82,31 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class CALL_DEF_CONTEXTMARKER
|
||||
{
|
||||
public:
|
||||
|
||||
CALL_DEF_CONTEXTMARKER()
|
||||
: IsDef (0),
|
||||
IsSet (0),
|
||||
MarkerType (Aspect_TOM_POINT),
|
||||
Scale (0),
|
||||
MarkerImage (NULL)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Standard_Integer IsDef;
|
||||
Standard_Integer IsSet;
|
||||
CALL_DEF_COLOR Color;
|
||||
Aspect_TypeOfMarker MarkerType;
|
||||
Standard_ShortReal Scale;
|
||||
Handle(Graphic3d_MarkerImage) MarkerImage;
|
||||
|
||||
};
|
||||
|
||||
class Graphic3d_CGroup
|
||||
{
|
||||
|
||||
|
@@ -458,21 +458,6 @@ is
|
||||
is deferred;
|
||||
---Purpose:
|
||||
|
||||
----------------------------------------
|
||||
-- Category: Methods to create Marker
|
||||
-- for Purpose : see Graphic3d_Group.cdl
|
||||
----------------------------------------
|
||||
|
||||
Marker ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
APoint : Vertex from Graphic3d )
|
||||
is deferred;
|
||||
|
||||
MarkerSet ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
ListVertex : Array1OfVertex from Graphic3d )
|
||||
is deferred;
|
||||
|
||||
----------------------------------------
|
||||
-- Category: Methods to create Text
|
||||
-- for Purpose : see Graphic3d_Group.cdl
|
||||
|
@@ -231,43 +231,7 @@ class Group from Graphic3d inherits TShared
|
||||
---Purpose: Sets the coordinates of the boundary box of the
|
||||
-- group <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
-------------------------------------
|
||||
-- Category: Methods to create Marker
|
||||
-------------------------------------
|
||||
|
||||
---------------------------------------------
|
||||
-- Summary of Markers --
|
||||
-- --
|
||||
-- They should have one or more vertices. --
|
||||
-- --
|
||||
-- They have the following attributes. --
|
||||
-- --
|
||||
-- Marker Type. --
|
||||
-- Marker Scale Factor. --
|
||||
-- Marker Color. --
|
||||
-- --
|
||||
-- The size, shape and orientation of a --
|
||||
-- marker is not subject to transformation --
|
||||
---------------------------------------------
|
||||
|
||||
Marker ( me : mutable;
|
||||
APoint : Vertex from Graphic3d;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Creates a marker in position <APoint> which will be drawn
|
||||
-- with the current attribute (AspectMarker).
|
||||
---Category: Methods to create Marker
|
||||
|
||||
MarkerSet ( me : mutable;
|
||||
ListVertex : Array1OfVertex from Graphic3d;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is static;
|
||||
---Purpose: Creates a group of markers defined by a table of
|
||||
-- vertices.
|
||||
---Category: Methods to create Marker
|
||||
|
||||
|
||||
-----------------------------------
|
||||
-- Category: Methods to create Text
|
||||
-----------------------------------
|
||||
|
@@ -1,92 +0,0 @@
|
||||
// Created by: NW,JPB,CAL
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux groupes
|
||||
// de primitives
|
||||
|
||||
//-Warning Un groupe est defini dans une structure
|
||||
// Il s'agit de la plus petite entite editable
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Graphic3d_Group.jxx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
void Graphic3d_Group::Marker (const Graphic3d_Vertex &APoint, const Standard_Boolean EvalMinMax)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_ShortReal X, Y, Z;
|
||||
APoint.Coord (X, Y, Z);
|
||||
if (X < MyBounds.XMin) MyBounds.XMin = X;
|
||||
if (Y < MyBounds.YMin) MyBounds.YMin = Y;
|
||||
if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
|
||||
if (X > MyBounds.XMax) MyBounds.XMax = X;
|
||||
if (Y > MyBounds.YMax) MyBounds.YMax = Y;
|
||||
if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
|
||||
}
|
||||
|
||||
MyGraphicDriver->Marker (MyCGroup, APoint);
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::MarkerSet (const Graphic3d_Array1OfVertex &ListVertex, const Standard_Boolean EvalMinMax)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_ShortReal X, Y, Z;
|
||||
Standard_Integer i = ListVertex.Lower ();
|
||||
const Standard_Integer Upper = ListVertex.Upper ();
|
||||
// Parcours des sommets
|
||||
for (; i<=Upper; i++) {
|
||||
ListVertex (i).Coord (X, Y, Z);
|
||||
if (X < MyBounds.XMin) MyBounds.XMin = X;
|
||||
if (Y < MyBounds.YMin) MyBounds.YMin = Y;
|
||||
if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
|
||||
if (X > MyBounds.XMax) MyBounds.XMax = X;
|
||||
if (Y > MyBounds.YMax) MyBounds.YMax = Y;
|
||||
if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
|
||||
}
|
||||
}
|
||||
|
||||
MyGraphicDriver->MarkerSet (MyCGroup, ListVertex);
|
||||
|
||||
Update ();
|
||||
}
|
@@ -286,39 +286,32 @@ void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFil
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
|
||||
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theCtx)
|
||||
{
|
||||
if (IsDeleted()) return;
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
Standard_Real aRed, aGreen, aBlue;
|
||||
Standard_Real aScale;
|
||||
Quantity_Color aColor;
|
||||
Aspect_TypeOfMarker aMarkerType;
|
||||
|
||||
Standard_Real R, G, B;
|
||||
Standard_Real AScale;
|
||||
Quantity_Color AColor;
|
||||
Aspect_TypeOfMarker AMType;
|
||||
theCtx->Values (aColor, aMarkerType, aScale);
|
||||
aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
|
||||
|
||||
CTX->Values (AColor, AMType, AScale);
|
||||
AColor.Values (R, G, B, Quantity_TOC_RGB);
|
||||
MyCGroup.ContextMarker.IsDef = 1;
|
||||
MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed);
|
||||
MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen);
|
||||
MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue);
|
||||
MyCGroup.ContextMarker.MarkerType = aMarkerType;
|
||||
MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale);
|
||||
MyCGroup.ContextMarker.MarkerImage = theCtx->GetMarkerImage();
|
||||
|
||||
MyCGroup.ContextMarker.Color.r = float (R);
|
||||
MyCGroup.ContextMarker.Color.g = float (G);
|
||||
MyCGroup.ContextMarker.Color.b = float (B);
|
||||
MyCGroup.ContextMarker.MarkerType = int (AMType);
|
||||
MyCGroup.ContextMarker.Scale = float (AScale);
|
||||
MyCGroup.ContextMarker.IsDef = 1;
|
||||
int noinsert = 1;
|
||||
MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
|
||||
|
||||
int noinsert = 1;
|
||||
if ( AMType == Aspect_TOM_USERDEFINED )
|
||||
{
|
||||
CTX->GetTextureSize( MyMarkWidth, MyMarkHeight );
|
||||
MyMarkArray = CTX->GetTexture();
|
||||
MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray);
|
||||
}
|
||||
else
|
||||
MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
|
||||
|
||||
MyCGroup.ContextMarker.IsSet = 1;
|
||||
|
||||
Update ();
|
||||
MyCGroup.ContextMarker.IsSet = 1;
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
|
||||
@@ -600,39 +593,32 @@ void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
|
||||
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& thCtx)
|
||||
{
|
||||
if (IsDeleted()) return;
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
Standard_Real aRed, aGreen, aBlue;
|
||||
Standard_Real aScale;
|
||||
Quantity_Color aColor;
|
||||
Aspect_TypeOfMarker aMarkerType;
|
||||
|
||||
Standard_Real R, G, B;
|
||||
Standard_Real AScale;
|
||||
Quantity_Color AColor;
|
||||
Aspect_TypeOfMarker AMType;
|
||||
thCtx->Values (aColor, aMarkerType, aScale);
|
||||
aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
|
||||
|
||||
CTX->Values (AColor, AMType, AScale);
|
||||
AColor.Values (R, G, B, Quantity_TOC_RGB);
|
||||
MyCGroup.ContextMarker.IsDef = 1;
|
||||
MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed);
|
||||
MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen);
|
||||
MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue);
|
||||
MyCGroup.ContextMarker.MarkerType = aMarkerType;
|
||||
MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale);
|
||||
MyCGroup.ContextMarker.MarkerImage = thCtx->GetMarkerImage();
|
||||
|
||||
MyCGroup.ContextMarker.Color.r = float (R);
|
||||
MyCGroup.ContextMarker.Color.g = float (G);
|
||||
MyCGroup.ContextMarker.Color.b = float (B);
|
||||
MyCGroup.ContextMarker.MarkerType = int (AMType);
|
||||
MyCGroup.ContextMarker.Scale = float (AScale);
|
||||
MyCGroup.ContextMarker.IsDef = 1;
|
||||
int noinsert = 0;
|
||||
MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
|
||||
|
||||
int noinsert = 0;
|
||||
if ( AMType == Aspect_TOM_USERDEFINED )
|
||||
{
|
||||
CTX->GetTextureSize( MyMarkWidth, MyMarkHeight );
|
||||
MyMarkArray = CTX->GetTexture();
|
||||
MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray);
|
||||
}
|
||||
else
|
||||
MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
|
||||
|
||||
MyCGroup.ContextMarker.IsSet = 1;
|
||||
|
||||
Update ();
|
||||
MyCGroup.ContextMarker.IsSet = 1;
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
|
||||
@@ -777,19 +763,19 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
|
||||
R = Standard_Real (MyCGroup.ContextMarker.Color.r);
|
||||
G = Standard_Real (MyCGroup.ContextMarker.Color.g);
|
||||
B = Standard_Real (MyCGroup.ContextMarker.Color.b);
|
||||
AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType);
|
||||
AMType = MyCGroup.ContextMarker.MarkerType;
|
||||
AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
|
||||
if( AMType == Aspect_TOM_USERDEFINED )
|
||||
{
|
||||
|
||||
CTXM->SetTexture( MyMarkWidth, MyMarkHeight, MyMarkArray );
|
||||
CTXM->SetBitMap( MyMarkWidth, MyMarkHeight, MyMarkArray );
|
||||
}
|
||||
}
|
||||
else {
|
||||
R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
|
||||
G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
|
||||
B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
|
||||
AMType = Aspect_TypeOfMarker (MyCGroup.Struct->ContextMarker.MarkerType);
|
||||
AMType = MyCGroup.Struct->ContextMarker.MarkerType;
|
||||
AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
|
||||
}
|
||||
AColor.SetValues (R, G, B, Quantity_TOC_RGB);
|
||||
|
226
src/Graphic3d/Graphic3d_MarkerImage.cxx
Normal file
226
src/Graphic3d/Graphic3d_MarkerImage.cxx
Normal file
@@ -0,0 +1,226 @@
|
||||
// Created on: 2013-06-25
|
||||
// Created by: Dmitry BOBYLEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <Graphic3d_MarkerImage.hxx>
|
||||
|
||||
#include <Image_PixMap.hxx>
|
||||
#include <Standard_Atomic.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
static volatile Standard_Integer THE_MARKER_IMAGE_COUNTER = 0;
|
||||
};
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (Graphic3d_MarkerImage, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_MarkerImage, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_MarkerImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_MarkerImage::Graphic3d_MarkerImage (const Handle(Image_PixMap)& theImage)
|
||||
: myBitMap (NULL),
|
||||
myImage (theImage),
|
||||
myImageAlpha (NULL),
|
||||
myMargin (1),
|
||||
myWidth ((Standard_Integer )theImage->Width()),
|
||||
myHeight ((Standard_Integer )theImage->Height())
|
||||
{
|
||||
myImageId = TCollection_AsciiString ("Graphic3d_MarkerImage_")
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_MARKER_IMAGE_COUNTER));
|
||||
|
||||
myImageAlphaId = TCollection_AsciiString ("Graphic3d_MarkerImageAlpha_")
|
||||
+ TCollection_AsciiString (THE_MARKER_IMAGE_COUNTER);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_MarkerImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_MarkerImage::Graphic3d_MarkerImage (const Handle(TColStd_HArray1OfByte)& theBitMap,
|
||||
const Standard_Integer& theWidth,
|
||||
const Standard_Integer& theHeight)
|
||||
: myBitMap (theBitMap),
|
||||
myImage (NULL),
|
||||
myImageAlpha (NULL),
|
||||
myMargin (1),
|
||||
myWidth (theWidth),
|
||||
myHeight (theHeight)
|
||||
{
|
||||
myImageId = TCollection_AsciiString ("Graphic3d_MarkerImage_")
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_MARKER_IMAGE_COUNTER));
|
||||
|
||||
myImageAlphaId = TCollection_AsciiString ("Graphic3d_MarkerImageAlpha_")
|
||||
+ TCollection_AsciiString (THE_MARKER_IMAGE_COUNTER);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetBitMapArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(TColStd_HArray1OfByte) Graphic3d_MarkerImage::GetBitMapArray (const Standard_Real& theAlphaValue) const
|
||||
{
|
||||
if (!myBitMap.IsNull())
|
||||
{
|
||||
return myBitMap;
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray1OfByte) aBitMap;
|
||||
if (myImage.IsNull())
|
||||
{
|
||||
return aBitMap;
|
||||
}
|
||||
|
||||
const Standard_Integer aNumOfBytesInRow = (Standard_Integer )(myImage->Width() / 8) + (myImage->Width() % 8 ? 1 : 0);
|
||||
const Standard_Integer aNumOfBytes = (Standard_Integer )(aNumOfBytesInRow * myImage->Height());
|
||||
const Standard_Integer aHeight = (Standard_Integer )myImage->Height();
|
||||
const Standard_Integer aWidth = (Standard_Integer )myImage->Width();
|
||||
aBitMap = new TColStd_HArray1OfByte (0, aNumOfBytes - 1);
|
||||
aBitMap->Init (0);
|
||||
for (Standard_Integer aRow = 0; aRow < aHeight; aRow++)
|
||||
{
|
||||
for (Standard_Integer aColumn = 0; aColumn < aWidth; aColumn++)
|
||||
{
|
||||
Quantity_Parameter anAlphaValue;
|
||||
Quantity_Color aColor = myImage->PixelColor (aColumn, aRow, anAlphaValue);
|
||||
Standard_Boolean aBitOn = Standard_False;
|
||||
|
||||
if (myImage->Format() == Image_PixMap::ImgGray)
|
||||
{
|
||||
aBitOn = aColor.Red() > theAlphaValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
aBitOn = anAlphaValue > theAlphaValue;
|
||||
}
|
||||
|
||||
aBitMap->ChangeValue (aNumOfBytesInRow * aRow + aColumn / 8) += aBitOn ? (0x80 >> (aColumn % 8)) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
return aBitMap;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImage()
|
||||
{
|
||||
if (!myImage.IsNull())
|
||||
{
|
||||
return myImage;
|
||||
}
|
||||
|
||||
if (myBitMap.IsNull())
|
||||
{
|
||||
return myImage;
|
||||
}
|
||||
|
||||
// Converting a byte array to bitmap image. Row and column offsets are used
|
||||
// to store bitmap in a square image, so the image will not be stretched
|
||||
// when rendering with point sprites.
|
||||
const Standard_Integer aNumOfBytesInRow = myWidth / 8 + (myWidth % 8 ? 1 : 0);
|
||||
const Standard_Integer aSize = Max (myWidth, myHeight);
|
||||
const Standard_Integer aRowOffset = (aSize - myHeight) / 2 + myMargin;
|
||||
const Standard_Integer aColumnOffset = (aSize - myWidth ) / 2 + myMargin;
|
||||
const Standard_Integer aLowerIndex = myBitMap->Lower();
|
||||
|
||||
myImage = new Image_PixMap();
|
||||
myImage->InitZero (Image_PixMap::ImgGray, aSize + myMargin * 2, aSize + myMargin * 2);
|
||||
for (Standard_Integer aRowIter = 0; aRowIter < myHeight; aRowIter++)
|
||||
{
|
||||
Standard_Byte* anImageRow = myImage->ChangeRow (aRowIter + aRowOffset);
|
||||
for (Standard_Integer aColumnIter = 0; aColumnIter < myWidth; aColumnIter++)
|
||||
{
|
||||
Standard_Boolean aBitOn = myBitMap->Value (aLowerIndex + aNumOfBytesInRow * aRowIter + aColumnIter / 8) & (0x80 >> (aColumnIter % 8));
|
||||
anImageRow[aColumnIter + aColumnOffset] = aBitOn ? 255 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
return myImage;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetImageAlpha
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImageAlpha()
|
||||
{
|
||||
if (!myImageAlpha.IsNull())
|
||||
{
|
||||
return myImageAlpha;
|
||||
}
|
||||
|
||||
if (!myImage.IsNull())
|
||||
{
|
||||
if (myImage->Format() == Image_PixMap::ImgGray)
|
||||
{
|
||||
myImageAlpha = myImage;
|
||||
}
|
||||
else
|
||||
{
|
||||
myImageAlpha = new Image_PixMap();
|
||||
myImageAlpha->InitZero (Image_PixMap::ImgGray, myImage->Width(), myImage->Height());
|
||||
myImageAlpha->SetTopDown (Standard_False);
|
||||
Quantity_Parameter anAlpha;
|
||||
for (Standard_Integer aRowIter = 0; aRowIter < myImage->Height(); aRowIter++)
|
||||
{
|
||||
Standard_Byte* anImageRow = myImageAlpha->ChangeRow (aRowIter);
|
||||
for (Standard_Integer aColumnIter = 0; aColumnIter < myImage->Width(); aColumnIter++)
|
||||
{
|
||||
myImage->PixelColor (aColumnIter, aRowIter, anAlpha);
|
||||
anImageRow[aColumnIter] = Standard_Byte (255.0 * anAlpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return myImageAlpha;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetImageId
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& Graphic3d_MarkerImage::GetImageId() const
|
||||
{
|
||||
return myImageId;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetImageAlphaId
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& Graphic3d_MarkerImage::GetImageAlphaId() const
|
||||
{
|
||||
return myImageAlphaId;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTextureSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MarkerImage::GetTextureSize (Standard_Integer& theWidth,
|
||||
Standard_Integer& theHeight) const
|
||||
{
|
||||
theWidth = myWidth;
|
||||
theHeight = myHeight;
|
||||
}
|
90
src/Graphic3d/Graphic3d_MarkerImage.hxx
Normal file
90
src/Graphic3d/Graphic3d_MarkerImage.hxx
Normal file
@@ -0,0 +1,90 @@
|
||||
// Created on: 2013-06-25
|
||||
// Created by: Dmitry BOBYLEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _Graphic3d_MarkerImage_H__
|
||||
#define _Graphic3d_MarkerImage_H__
|
||||
|
||||
#include <Graphic3d_MarkerImage_Handle.hxx>
|
||||
|
||||
#include <Handle_TColStd_HArray1OfByte.hxx>
|
||||
#include <Image_PixMap_Handle.hxx>
|
||||
#include <Quantity_Parameter.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//! This class is used to store bitmaps and images for markers rendering.
|
||||
//! It can convert bitmap texture stored in TColStd_HArray1OfByte to Image_PixMap and vice versa.
|
||||
class Graphic3d_MarkerImage : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! @param theImage - source image
|
||||
Standard_EXPORT Graphic3d_MarkerImage (const Handle(Image_PixMap)& theImage);
|
||||
|
||||
//! Creates marker image from array of bytes
|
||||
//! (method for compatibility with old markers definition).
|
||||
//! @param theBitMap - source bitmap stored as array of bytes
|
||||
//! @param theWidth - number of bits in a row
|
||||
//! @param theHeight - number of bits in a column
|
||||
Standard_EXPORT Graphic3d_MarkerImage (const Handle(TColStd_HArray1OfByte)& theBitMap,
|
||||
const Standard_Integer& theWidth,
|
||||
const Standard_Integer& theHeight);
|
||||
|
||||
//! @param theAlphaValue pixels in the image that have alpha value greater than
|
||||
//! or equal to this parameter will be stored in bitmap as "1",
|
||||
//! others will be stored as "0"
|
||||
//! @return marker image as array of bytes. If an instance of the class has been
|
||||
//! initialized with image, it will be converted to bitmap based on the parameter theAlphaValue.
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfByte) GetBitMapArray (const Standard_Real& theAlphaValue = 0.5) const;
|
||||
|
||||
//! @return marker image. If an instance of the class has been initialized with a bitmap, it will be
|
||||
//! converted to image.
|
||||
Standard_EXPORT const Handle(Image_PixMap)& GetImage();
|
||||
|
||||
//! @return image alpha as grayscale image. Note that if an instance of the class has been initialized
|
||||
//! with a bitmap or with grayscale image this method will return exactly the same image as GetImage()
|
||||
Standard_EXPORT const Handle(Image_PixMap)& GetImageAlpha();
|
||||
|
||||
//! @return an unique ID. This ID will be used to manage resource in graphic driver.
|
||||
Standard_EXPORT const TCollection_AsciiString& GetImageId() const;
|
||||
|
||||
//! @return an unique ID. This ID will be used to manage resource in graphic driver.
|
||||
Standard_EXPORT const TCollection_AsciiString& GetImageAlphaId() const;
|
||||
|
||||
//! @return texture size
|
||||
Standard_EXPORT void GetTextureSize (Standard_Integer& theWidth,
|
||||
Standard_Integer& theHeight) const;
|
||||
|
||||
private:
|
||||
|
||||
TCollection_AsciiString myImageId; //!< resource identifier
|
||||
TCollection_AsciiString myImageAlphaId; //!< resource identifier
|
||||
Handle(TColStd_HArray1OfByte) myBitMap; //!< bytes array with bitmap definition (for compatibility with old code)
|
||||
Handle(Image_PixMap) myImage; //!< full-color marker definition
|
||||
Handle(Image_PixMap) myImageAlpha; //!< alpha-color marker definition (for dynamic hi-lighting)
|
||||
Standard_Integer myMargin; //!< extra margin from boundaries for bitmap -> point sprite conversion, 1 px by default
|
||||
Standard_Integer myWidth; //!< marker width
|
||||
Standard_Integer myHeight; //!< marker height
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(Graphic3d_MarkerImage) // Type definition
|
||||
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_MarkerImage_H__
|
30
src/Graphic3d/Graphic3d_MarkerImage_Handle.hxx
Normal file
30
src/Graphic3d/Graphic3d_MarkerImage_Handle.hxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// Created on: 2013-06-25
|
||||
// Created by: Dmitry BOBYLEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _Graphic3d_TextureBitMap_Handle_H__
|
||||
#define _Graphic3d_TextureBitMap_Handle_H__
|
||||
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <Handle_Standard_Transient.hxx>
|
||||
|
||||
class Graphic3d_TextureBitMap;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_MarkerImage, Standard_Transient)
|
||||
typedef Handle(Graphic3d_MarkerImage) Graphic3d_MarkerImage_Handle;
|
||||
|
||||
#endif // _Graphic3d_TextureBitMap_Handle_H__
|
@@ -795,7 +795,7 @@ Handle(Graphic3d_AspectMarker3d) Graphic3d_Structure::Marker3dAspect () const {
|
||||
G = Standard_Real (MyCStructure.ContextMarker.Color.g);
|
||||
B = Standard_Real (MyCStructure.ContextMarker.Color.b);
|
||||
AColor.SetValues (R, G, B, Quantity_TOC_RGB);
|
||||
AMType = Aspect_TypeOfMarker (MyCStructure.ContextMarker.MarkerType);
|
||||
AMType = MyCStructure.ContextMarker.MarkerType;
|
||||
AScale = Standard_Real (MyCStructure.ContextMarker.Scale);
|
||||
|
||||
Handle(Graphic3d_AspectMarker3d) CTXM =
|
||||
@@ -1303,7 +1303,7 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectMark
|
||||
MyCStructure.ContextMarker.Color.r = float (R);
|
||||
MyCStructure.ContextMarker.Color.g = float (G);
|
||||
MyCStructure.ContextMarker.Color.b = float (B);
|
||||
MyCStructure.ContextMarker.MarkerType = int (AMType);
|
||||
MyCStructure.ContextMarker.MarkerType = AMType;
|
||||
MyCStructure.ContextMarker.Scale = float (AScale);
|
||||
MyCStructure.ContextMarker.IsDef = 1;
|
||||
|
||||
@@ -2076,7 +2076,7 @@ void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)&
|
||||
MyCStructure.ContextMarker.Color.r = float (R);
|
||||
MyCStructure.ContextMarker.Color.g = float (G);
|
||||
MyCStructure.ContextMarker.Color.b = float (B);
|
||||
MyCStructure.ContextMarker.MarkerType = int (AMType);
|
||||
MyCStructure.ContextMarker.MarkerType = AMType;
|
||||
MyCStructure.ContextMarker.Scale = float (AScale);
|
||||
|
||||
CTXT->Values (AColor, AFont, AnExpansion, ASpace,AStyleT,ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
|
||||
|
Reference in New Issue
Block a user