mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0025305: Visualization, TKOpenGl - support stipple line aspects within built-in GLSL programs
OpenGl_LineAttributes - drop display lists for stipple lines. OpenGl_Context - add methods OpenGl_Context::SetTypeOfLine() and OpenGl_Context::SetLineWidth() to setup line aspects. OpenGl_ShaderManager::prepareStdProgramFlat() - support new bit OpenGl_PO_StippleLine. vaspects command - add -setlinetype option.
This commit is contained in:
parent
751955d4d7
commit
ac116c221f
@ -49,6 +49,13 @@
|
||||
#include <GL/glx.h> // glXGetProcAddress()
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
#include <gl2ps.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment (lib, "gl2ps.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_Context, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context, Standard_Transient)
|
||||
|
||||
@ -2411,6 +2418,104 @@ void OpenGl_Context::SetColor4fv (const OpenGl_Vec4& theColor)
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTypeOfLine
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetTypeOfLine (const Aspect_TypeOfLine theType,
|
||||
const Standard_ShortReal theFactor)
|
||||
{
|
||||
Standard_Integer aPattern = 0xFFFF;
|
||||
switch (theType)
|
||||
{
|
||||
case Aspect_TOL_DASH:
|
||||
{
|
||||
aPattern = 0xFFC0;
|
||||
break;
|
||||
}
|
||||
case Aspect_TOL_DOT:
|
||||
{
|
||||
aPattern = 0xCCCC;
|
||||
break;
|
||||
}
|
||||
case Aspect_TOL_DOTDASH:
|
||||
{
|
||||
aPattern = 0xFF18;
|
||||
break;
|
||||
}
|
||||
case Aspect_TOL_SOLID:
|
||||
{
|
||||
aPattern = 0xFFFF;
|
||||
break;
|
||||
}
|
||||
case Aspect_TOL_USERDEFINED:
|
||||
{
|
||||
aPattern = 0xFF24;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (myActiveProgram != NULL)
|
||||
{
|
||||
myActiveProgram->SetUniform (this, "uPattern", aPattern);
|
||||
myActiveProgram->SetUniform (this, "uFactor", theFactor);
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (theType != Aspect_TOL_SOLID)
|
||||
{
|
||||
#ifdef HAVE_GL2PS
|
||||
if (IsFeedback())
|
||||
{
|
||||
gl2psEnable (GL2PS_LINE_STIPPLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (core11 != NULL)
|
||||
{
|
||||
core11fwd->glEnable (GL_LINE_STIPPLE);
|
||||
|
||||
core11->glLineStipple (static_cast<GLint> (theFactor),
|
||||
static_cast<GLushort> (aPattern));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (core11 != NULL)
|
||||
{
|
||||
core11fwd->glDisable (GL_LINE_STIPPLE);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
if (IsFeedback())
|
||||
{
|
||||
gl2psDisable (GL2PS_LINE_STIPPLE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetLineWidth
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth)
|
||||
{
|
||||
if (core11 != NULL)
|
||||
{
|
||||
// glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f
|
||||
core11fwd->glLineWidth (theWidth);
|
||||
}
|
||||
#ifdef HAVE_GL2PS
|
||||
if (IsFeedback())
|
||||
{
|
||||
gl2psLineWidth (theWidth);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetPointSize
|
||||
// purpose :
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <Aspect_Drawable.hxx>
|
||||
#include <Aspect_Display.hxx>
|
||||
#include <Aspect_RenderingContext.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Handle_OpenGl_Context.hxx>
|
||||
#include <Handle_OpenGl_FrameBuffer.hxx>
|
||||
#include <Handle_OpenGl_Sampler.hxx>
|
||||
@ -532,6 +533,13 @@ public: //! @name methods to alter or retrieve current state
|
||||
//! Setup current color.
|
||||
Standard_EXPORT void SetColor4fv (const OpenGl_Vec4& theColor);
|
||||
|
||||
//! Setup type of line.
|
||||
Standard_EXPORT void SetTypeOfLine (const Aspect_TypeOfLine theType,
|
||||
const Standard_ShortReal theFactor = 1.0f);
|
||||
|
||||
//! Setup width of line.
|
||||
Standard_EXPORT void SetLineWidth (const Standard_ShortReal theWidth);
|
||||
|
||||
//! Setup point size.
|
||||
Standard_EXPORT void SetPointSize (const Standard_ShortReal theSize);
|
||||
|
||||
|
@ -270,17 +270,13 @@ void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer theType,
|
||||
|
||||
if (TheLayerProp.LineType != theType)
|
||||
{
|
||||
Handle(OpenGl_LineAttributes) aLineAttribs;
|
||||
if (aCtx->GetResource ("OpenGl_LineAttributes", aLineAttribs))
|
||||
{
|
||||
TheLayerProp.LineType = theType;
|
||||
aLineAttribs->SetTypeOfLine ((Aspect_TypeOfLine )theType);
|
||||
}
|
||||
TheLayerProp.LineType = theType;
|
||||
aCtx->SetTypeOfLine ((Aspect_TypeOfLine) theType);
|
||||
}
|
||||
if (TheLayerProp.LineWidth != theWidth)
|
||||
{
|
||||
TheLayerProp.LineWidth = theWidth;
|
||||
glLineWidth ((GLfloat )theWidth);
|
||||
aCtx->SetLineWidth (theWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,15 +18,6 @@
|
||||
#include <OpenGl_LineAttributes.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
|
||||
#ifdef HAVE_GL2PS
|
||||
#include <gl2ps.h>
|
||||
#endif
|
||||
|
||||
#define DOT_LS 0xCCCC
|
||||
#define DASH_DOT_LS 0xFF18
|
||||
#define DASH_LS 0xFFC0
|
||||
#define DASH_DDOT_LS 0xFF24
|
||||
|
||||
static const unsigned int myInteriors[TEL_HS_USER_DEF_START][32] =
|
||||
{
|
||||
//TEL_HS_SOLID
|
||||
@ -494,8 +485,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_LineAttributes, OpenGl_Resource)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_LineAttributes::OpenGl_LineAttributes()
|
||||
: myLinestyleBase(0),
|
||||
myPatternBase(0)
|
||||
: myPatternBase(0)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -515,17 +505,6 @@ OpenGl_LineAttributes::~OpenGl_LineAttributes()
|
||||
// =======================================================================
|
||||
void OpenGl_LineAttributes::Release (OpenGl_Context* theGlCtx)
|
||||
{
|
||||
// Delete line styles
|
||||
if (myLinestyleBase != 0)
|
||||
{
|
||||
if (theGlCtx->IsValid())
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glDeleteLists ((GLuint )myLinestyleBase, 5);
|
||||
#endif
|
||||
}
|
||||
myLinestyleBase = 0;
|
||||
}
|
||||
// Delete surface patterns
|
||||
if (myPatternBase != 0)
|
||||
{
|
||||
@ -546,7 +525,7 @@ void OpenGl_LineAttributes::Release (OpenGl_Context* theGlCtx)
|
||||
void OpenGl_LineAttributes::Init (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
// Return if already initialized
|
||||
if (myLinestyleBase != 0)
|
||||
if (myPatternBase != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -557,25 +536,6 @@ void OpenGl_LineAttributes::Init (const Handle(OpenGl_Context)& theGlCtx)
|
||||
return;
|
||||
}
|
||||
|
||||
myLinestyleBase = theGlCtx->core11->glGenLists (5);
|
||||
|
||||
// Line
|
||||
glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_DASH, GL_COMPILE);
|
||||
glLineStipple (1, DASH_LS);
|
||||
glEndList();
|
||||
|
||||
glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_DOT, GL_COMPILE);
|
||||
glLineStipple (1, DOT_LS);
|
||||
glEndList();
|
||||
|
||||
glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_DOTDASH, GL_COMPILE);
|
||||
glLineStipple (1, DASH_DOT_LS);
|
||||
glEndList();
|
||||
|
||||
glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_USERDEFINED, GL_COMPILE);
|
||||
glLineStipple (1, DASH_DDOT_LS);
|
||||
glEndList();
|
||||
|
||||
// GL_POLYGON_STIPPLE need 32x32 stipple patterns
|
||||
const int nbi = sizeof(myInteriors) / (32 * sizeof(unsigned int));
|
||||
myPatternBase = glGenLists(TEL_HS_USER_DEF_START);
|
||||
@ -588,37 +548,6 @@ void OpenGl_LineAttributes::Init (const Handle(OpenGl_Context)& theGlCtx)
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTypeOfLine
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_LineAttributes::SetTypeOfLine (const Aspect_TypeOfLine theType) const
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (theType != Aspect_TOL_SOLID)
|
||||
{
|
||||
if (myLinestyleBase != 0)
|
||||
{
|
||||
glCallList ((GLuint )myLinestyleBase + (GLuint )theType);
|
||||
glEnable (GL_LINE_STIPPLE);
|
||||
}
|
||||
#ifdef HAVE_GL2PS
|
||||
gl2psEnable (GL2PS_LINE_STIPPLE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myLinestyleBase != 0)
|
||||
{
|
||||
glDisable (GL_LINE_STIPPLE);
|
||||
}
|
||||
#ifdef HAVE_GL2PS
|
||||
gl2psDisable (GL2PS_LINE_STIPPLE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTypeOfHatch
|
||||
// purpose :
|
||||
|
@ -35,13 +35,10 @@ public:
|
||||
void Init (const Handle(OpenGl_Context)& theGlCtx);
|
||||
virtual void Release (OpenGl_Context* theGlCtx);
|
||||
|
||||
void SetTypeOfLine (const Aspect_TypeOfLine theType) const;
|
||||
|
||||
void SetTypeOfHatch (const int theType) const;
|
||||
|
||||
protected:
|
||||
|
||||
unsigned int myLinestyleBase;
|
||||
unsigned int myPatternBase;
|
||||
|
||||
public:
|
||||
|
@ -483,7 +483,11 @@ void OpenGl_PrimitiveArray::drawEdges (const TEL_COLOUR* theEdgeCo
|
||||
/// 2) draw elements from vertex array, when bounds defines count of primitive's vertices.
|
||||
/// 3) draw primitive's edges by vertexes if no edges and bounds array is specified
|
||||
myVboAttribs->BindPositionAttribute (aGlContext);
|
||||
aGlContext->SetColor4fv (*(const OpenGl_Vec4* )theEdgeColour->rgb);
|
||||
|
||||
aGlContext->SetColor4fv (*(const OpenGl_Vec4* )theEdgeColour->rgb);
|
||||
aGlContext->SetTypeOfLine (anAspect->Type());
|
||||
aGlContext->SetLineWidth (anAspect->Width());
|
||||
|
||||
if (!myVboIndices.IsNull())
|
||||
{
|
||||
myVboIndices->Bind (aGlContext);
|
||||
@ -801,6 +805,12 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
||||
}
|
||||
|
||||
aCtx->SetColor4fv (*(const OpenGl_Vec4* )(myDrawMode <= GL_LINE_STRIP ? aLineColor->rgb : anInteriorColor->rgb));
|
||||
if (myDrawMode == GL_LINES
|
||||
|| myDrawMode == GL_LINE_STRIP)
|
||||
{
|
||||
aCtx->SetTypeOfLine (anAspectLine->Type());
|
||||
aCtx->SetLineWidth (anAspectLine->Width());
|
||||
}
|
||||
|
||||
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
||||
}
|
||||
|
@ -22,13 +22,14 @@
|
||||
//! Standard GLSL program combination bits.
|
||||
enum OpenGl_ProgramOptions
|
||||
{
|
||||
OpenGl_PO_ClipPlanes = 0x01, //!< handle clipping planes
|
||||
OpenGl_PO_Point = 0x02, //!< point marker
|
||||
OpenGl_PO_VertColor = 0x04, //!< per-vertex color
|
||||
OpenGl_PO_TextureRGB = 0x08, //!< handle RGB texturing
|
||||
OpenGl_PO_TextureA = 0x10, //!< handle Alpha texturing
|
||||
OpenGl_PO_TextureEnv = 0x20, //!< handle environment map
|
||||
OpenGl_PO_NB = 0x40 //!< overall number of combinations
|
||||
OpenGl_PO_ClipPlanes = 0x01, //!< handle clipping planes
|
||||
OpenGl_PO_Point = 0x02, //!< point marker
|
||||
OpenGl_PO_VertColor = 0x04, //!< per-vertex color
|
||||
OpenGl_PO_TextureRGB = 0x08, //!< handle RGB texturing
|
||||
OpenGl_PO_TextureA = 0x10, //!< handle Alpha texturing
|
||||
OpenGl_PO_TextureEnv = 0x20, //!< handle environment map
|
||||
OpenGl_PO_StippleLine = 0x40, //!< stipple line
|
||||
OpenGl_PO_NB = 0x80 //!< overall number of combinations
|
||||
};
|
||||
|
||||
//! Alias to programs array of predefined length
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <OpenGl_ShaderProgram.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_SetOfShaderPrograms, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_SetOfShaderPrograms, Standard_Transient)
|
||||
|
||||
@ -1234,6 +1236,52 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFlat (Handle(OpenGl_Shad
|
||||
aSrcFragExtraMain += THE_FRAG_CLIP_PLANES;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aSrcVertEndMain;
|
||||
if ((theBits & OpenGl_PO_StippleLine) != 0)
|
||||
{
|
||||
bool hasCaps = false;
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
if (myContext->IsGlGreaterEqual (3, 0))
|
||||
{
|
||||
aProgramSrc->SetHeader ("#version 300 es");
|
||||
hasCaps = true;
|
||||
}
|
||||
#else
|
||||
if (myContext->core32 != NULL)
|
||||
{
|
||||
aProgramSrc->SetHeader ("#version 150");
|
||||
hasCaps = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hasCaps)
|
||||
{
|
||||
aSrcVertExtraOut +=
|
||||
EOL"THE_SHADER_OUT vec2 ScreenSpaceCoord;";
|
||||
aSrcFragExtraOut +=
|
||||
EOL"THE_SHADER_IN vec2 ScreenSpaceCoord;"
|
||||
EOL"uniform int uPattern;"
|
||||
EOL"uniform float uFactor;";
|
||||
aSrcVertEndMain =
|
||||
EOL" ScreenSpaceCoord = gl_Position.xy / gl_Position.w;";
|
||||
aSrcFragMainGetColor =
|
||||
EOL" float anAngle = atan (dFdx (ScreenSpaceCoord.x), dFdy (ScreenSpaceCoord.y));"
|
||||
EOL" float aRotatePoint = gl_FragCoord.x * sin (anAngle) + gl_FragCoord.y * cos (anAngle);"
|
||||
EOL" uint aBit = uint (floor (aRotatePoint / uFactor + 0.5)) & 15U;"
|
||||
EOL" if ((uint (uPattern) & (1U << aBit)) == 0U) discard;"
|
||||
EOL" vec4 aColor = getColor();"
|
||||
EOL" if (aColor.a <= 0.1) discard;"
|
||||
EOL" occFragColor = aColor;";
|
||||
}
|
||||
else
|
||||
{
|
||||
const TCollection_ExtendedString aWarnMessage =
|
||||
"Warning: stipple lines in GLSL will be ignored.";
|
||||
myContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_PORTABILITY_ARB, 0, GL_DEBUG_SEVERITY_HIGH_ARB, aWarnMessage);
|
||||
}
|
||||
}
|
||||
|
||||
aSrcVert =
|
||||
aSrcVertExtraFunc
|
||||
+ aSrcVertExtraOut
|
||||
@ -1241,7 +1289,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFlat (Handle(OpenGl_Shad
|
||||
EOL"{"
|
||||
+ aSrcVertExtraMain
|
||||
+ EOL" gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * occVertex;"
|
||||
EOL"}";
|
||||
+ aSrcVertEndMain
|
||||
+ EOL"}";
|
||||
|
||||
aSrcFrag =
|
||||
aSrcFragExtraOut
|
||||
|
@ -105,7 +105,12 @@ public:
|
||||
return bindProgramWithState (theCustomProgram, theAspect);
|
||||
}
|
||||
|
||||
const Standard_Integer aBits = getProgramBits (theTexture, theHasVertColor);
|
||||
Standard_Integer aBits = getProgramBits (theTexture, theHasVertColor);
|
||||
if (theAspect->Type() != Aspect_TOL_SOLID)
|
||||
{
|
||||
aBits |= OpenGl_PO_StippleLine;
|
||||
}
|
||||
|
||||
Handle(OpenGl_ShaderProgram)& aProgram = getStdProgram (theToLightOn, aBits);
|
||||
return bindProgramWithState (aProgram, theAspect);
|
||||
}
|
||||
|
@ -301,6 +301,9 @@ void OpenGl_Workspace::ResetAppliedAspect()
|
||||
AspectFace(Standard_True);
|
||||
AspectMarker(Standard_True);
|
||||
AspectText(Standard_True);
|
||||
|
||||
myGlContext->SetTypeOfLine (myDefaultAspectLine.Type());
|
||||
myGlContext->SetLineWidth (myDefaultAspectLine.Width());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@ -263,26 +263,13 @@ const OpenGl_AspectText * OpenGl_Workspace::SetAspectText(const OpenGl_AspectTex
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
const OpenGl_AspectLine * OpenGl_Workspace::AspectLine(const Standard_Boolean WithApply)
|
||||
const OpenGl_AspectLine * OpenGl_Workspace::AspectLine(const Standard_Boolean theWithApply)
|
||||
{
|
||||
if ( WithApply && (AspectLine_set != AspectLine_applied) )
|
||||
if (theWithApply)
|
||||
{
|
||||
myGlContext->SetColor4fv (*(const OpenGl_Vec4* )AspectLine_set->Color().rgb);
|
||||
if ( !AspectLine_applied || (AspectLine_set->Type() != AspectLine_applied->Type() ) )
|
||||
{
|
||||
myLineAttribs->SetTypeOfLine (AspectLine_set->Type());
|
||||
}
|
||||
|
||||
if ( !AspectLine_applied || ( AspectLine_set->Width() != AspectLine_applied->Width() ) )
|
||||
{
|
||||
glLineWidth( (GLfloat)AspectLine_set->Width() );
|
||||
#ifdef HAVE_GL2PS
|
||||
gl2psLineWidth( (GLfloat)AspectLine_set->Width() );
|
||||
#endif
|
||||
}
|
||||
|
||||
AspectLine_applied = AspectLine_set;
|
||||
}
|
||||
|
||||
return AspectLine_set;
|
||||
}
|
||||
|
||||
|
@ -1357,6 +1357,9 @@ struct ViewerTest_AspectsChangeSet
|
||||
Standard_Integer ToSetLineWidth;
|
||||
Standard_Real LineWidth;
|
||||
|
||||
Standard_Integer ToSetTypeOfLine;
|
||||
Aspect_TypeOfLine TypeOfLine;
|
||||
|
||||
Standard_Integer ToSetTransparency;
|
||||
Standard_Real Transparency;
|
||||
|
||||
@ -1380,6 +1383,8 @@ struct ViewerTest_AspectsChangeSet
|
||||
Color (DEFAULT_COLOR),
|
||||
ToSetLineWidth (0),
|
||||
LineWidth (1.0),
|
||||
ToSetTypeOfLine (0),
|
||||
TypeOfLine (Aspect_TOL_SOLID),
|
||||
ToSetTransparency (0),
|
||||
Transparency (0.0),
|
||||
ToSetMaterial (0),
|
||||
@ -1747,6 +1752,45 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
|
||||
aChangeSet->ToSetColor = 1;
|
||||
anArgIter += aNbComps;
|
||||
}
|
||||
else if (anArg == "-setlinetype")
|
||||
{
|
||||
if (++anArgIter >= theArgNb)
|
||||
{
|
||||
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aValue (theArgVec[anArgIter]);
|
||||
aValue.LowerCase();
|
||||
|
||||
if (aValue.IsEqual ("solid"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_SOLID;
|
||||
}
|
||||
else if (aValue.IsEqual ("dot"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_DOT;
|
||||
}
|
||||
else if (aValue.IsEqual ("dash"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_DASH;
|
||||
}
|
||||
else if (aValue.IsEqual ("dotdash"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_DOTDASH;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
aChangeSet->ToSetTypeOfLine = 1;
|
||||
}
|
||||
else if (anArg == "-unsetlinetype")
|
||||
{
|
||||
aChangeSet->ToSetTypeOfLine = -1;
|
||||
}
|
||||
else if (anArg == "-unsetcolor")
|
||||
{
|
||||
aChangeSet->ToSetColor = -1;
|
||||
@ -1918,6 +1962,8 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
|
||||
aChangeSet->Visibility = 1;
|
||||
aChangeSet->ToSetLineWidth = -1;
|
||||
aChangeSet->LineWidth = 1.0;
|
||||
aChangeSet->ToSetTypeOfLine = -1;
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_SOLID;
|
||||
aChangeSet->ToSetTransparency = -1;
|
||||
aChangeSet->Transparency = 0.0;
|
||||
aChangeSet->ToSetColor = -1;
|
||||
@ -1975,6 +2021,14 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
|
||||
aDrawer->WireAspect()->SetColor (aChangeSet->Color);
|
||||
aDrawer->PointAspect()->SetColor (aChangeSet->Color);
|
||||
}
|
||||
if (aChangeSet->ToSetTypeOfLine != 0)
|
||||
{
|
||||
aDrawer->LineAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->WireAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->FreeBoundaryAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->UnFreeBoundaryAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->SeenLineAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
}
|
||||
if (aChangeSet->ToSetTransparency != 0)
|
||||
{
|
||||
aDrawer->ShadingAspect()->SetTransparency (aChangeSet->Transparency);
|
||||
@ -2112,6 +2166,15 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
|
||||
aDrawer->SetFreeBoundaryAspect (aBoundaryAspect);
|
||||
toRedisplay = Standard_True;
|
||||
}
|
||||
if (aChangeSet->ToSetTypeOfLine != 0)
|
||||
{
|
||||
aDrawer->LineAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->WireAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->FreeBoundaryAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->UnFreeBoundaryAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
aDrawer->SeenLineAspect()->SetTypeOfLine (aChangeSet->TypeOfLine);
|
||||
toRedisplay = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
for (aChangesIter.Next(); aChangesIter.More(); aChangesIter.Next())
|
||||
@ -5302,11 +5365,12 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
||||
|
||||
theCommands.Add("vaspects",
|
||||
"vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]"
|
||||
"\n\t\t: [-setvisibility 0|1]"
|
||||
"\n\t\t: [-setcolor ColorName] [-setcolor R G B] [-unsetcolor]"
|
||||
"\n\t\t: [-setmaterial MatName] [-unsetmaterial]"
|
||||
"\n\t\t: [-settransparency Transp] [-unsettransparency]"
|
||||
"\n\t\t: [-setwidth LineWidth] [-unsetwidth]"
|
||||
"\n\t\t: [-setVisibility 0|1]"
|
||||
"\n\t\t: [-setColor ColorName] [-setcolor R G B] [-unsetColor]"
|
||||
"\n\t\t: [-setMaterial MatName] [-unsetMaterial]"
|
||||
"\n\t\t: [-setTransparency Transp] [-unsetTransparency]"
|
||||
"\n\t\t: [-setWidth LineWidth] [-unsetWidth]"
|
||||
"\n\t\t: [-setLineType {solid|dash|dot|dotDash}] [-unsetLineType]"
|
||||
"\n\t\t: [-freeBoundary {off/on | 0/1}]"
|
||||
"\n\t\t: [-setFreeBoundaryWidth Width] [-unsetFreeBoundaryWidth]"
|
||||
"\n\t\t: [-setFreeBoundaryColor {ColorName | R G B}] [-unsetFreeBoundaryColor]"
|
||||
|
14
tests/v3d/glsl/stipple_line
Normal file
14
tests/v3d/glsl/stipple_line
Normal file
@ -0,0 +1,14 @@
|
||||
restore [locate_data_file occ/fuse.brep] f
|
||||
|
||||
vcaps -ffp 1
|
||||
vinit View1
|
||||
vclear
|
||||
vsetdispmode 0
|
||||
vaxo
|
||||
vdisplay f
|
||||
vaspects f -setLineType dotDash
|
||||
vfit
|
||||
vdump $::imagedir/${::casename}_ffp.png
|
||||
|
||||
vcaps -ffp 0
|
||||
vdump $::imagedir/${::casename}_glsl.png
|
Loading…
x
Reference in New Issue
Block a user