mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0029074: Visualization, TKOpenGl - support Geometry Shader definition
Graphic3d_TypeOfShaderObject enumeration has been extended by Geometry shader object type. OpenGl_ShaderProgram::Initialize() processes new shader object types when supported by OpenGL version. Declarations.glsl has been fixed so that occFragColor is defined only for Fragment Shader object only (by handling new FRAGMENT_SHADER macros). Improved documentation of Graphic3d_ArrayOfPrimitives class. vshader Draw Harness command has been extended to support definition of Shader Object types other than Vertex and Fragment shader.
This commit is contained in:
@@ -1089,10 +1089,11 @@ inline void setAspectProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
|
||||
// function : SetShaderProgram
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
|
||||
bool Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
|
||||
const Graphic3d_GroupAspect theAspect,
|
||||
const bool theToOverrideDefaults)
|
||||
{
|
||||
bool isUpdateNeeded = false;
|
||||
switch (theAspect)
|
||||
{
|
||||
case Graphic3d_ASPECT_LINE:
|
||||
@@ -1101,6 +1102,7 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
{
|
||||
if (!myHasOwnUIsoAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
Handle(Prs3d_IsoAspect) anAspect = UIsoAspect();
|
||||
if (!myLink.IsNull())
|
||||
{
|
||||
@@ -1112,6 +1114,7 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
}
|
||||
if (!myHasOwnVIsoAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
Handle(Prs3d_IsoAspect) anAspect = VIsoAspect();
|
||||
if (!myLink.IsNull())
|
||||
{
|
||||
@@ -1123,62 +1126,74 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
}
|
||||
if (!myHasOwnWireAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myWireAspect, WireAspect());
|
||||
myHasOwnWireAspect = true;
|
||||
}
|
||||
if (!myHasOwnLineAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myLineAspect, LineAspect());
|
||||
myHasOwnLineAspect = true;
|
||||
}
|
||||
if (!myHasOwnSeenLineAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, mySeenLineAspect, SeenLineAspect());
|
||||
myHasOwnSeenLineAspect = true;
|
||||
}
|
||||
if (!myHasOwnHiddenLineAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myHiddenLineAspect, HiddenLineAspect());
|
||||
myHasOwnHiddenLineAspect = true;
|
||||
}
|
||||
if (!myHasOwnVectorAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myVectorAspect, VectorAspect());
|
||||
myHasOwnVectorAspect = true;
|
||||
}
|
||||
if (!myHasOwnSectionAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, mySectionAspect, SectionAspect());
|
||||
myHasOwnSectionAspect = true;
|
||||
}
|
||||
if (!myHasOwnFreeBoundaryAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myFreeBoundaryAspect, FreeBoundaryAspect());
|
||||
myHasOwnFreeBoundaryAspect = true;
|
||||
}
|
||||
if (!myHasOwnUnFreeBoundaryAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myUnFreeBoundaryAspect, UnFreeBoundaryAspect());
|
||||
myHasOwnUnFreeBoundaryAspect = true;
|
||||
}
|
||||
if (!myHasOwnFaceBoundaryAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
copyLineAspect (myLink, myFaceBoundaryAspect, FaceBoundaryAspect());
|
||||
myHasOwnFaceBoundaryAspect = true;
|
||||
}
|
||||
|
||||
if (!myHasOwnPlaneAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
myPlaneAspect = new Prs3d_PlaneAspect();
|
||||
myHasOwnPlaneAspect = true;
|
||||
}
|
||||
if (!myHasOwnArrowAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
myArrowAspect = new Prs3d_ArrowAspect();
|
||||
myHasOwnArrowAspect = true;
|
||||
}
|
||||
if (!myHasOwnDatumAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
myDatumAspect = new Prs3d_DatumAspect();
|
||||
myHasOwnDatumAspect = true;
|
||||
}
|
||||
@@ -1208,13 +1223,14 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_ZAxis));
|
||||
}
|
||||
setAspectProgram (theProgram, myHasOwnArrowAspect, myArrowAspect);
|
||||
return;
|
||||
return isUpdateNeeded;
|
||||
}
|
||||
case Graphic3d_ASPECT_TEXT:
|
||||
{
|
||||
if (theToOverrideDefaults
|
||||
&& !myHasOwnTextAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
myTextAspect = new Prs3d_TextAspect();
|
||||
myHasOwnTextAspect = true;
|
||||
if (!myLink.IsNull())
|
||||
@@ -1224,13 +1240,14 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
}
|
||||
|
||||
setAspectProgram (theProgram, myHasOwnTextAspect, myTextAspect);
|
||||
return;
|
||||
return isUpdateNeeded;
|
||||
}
|
||||
case Graphic3d_ASPECT_MARKER:
|
||||
{
|
||||
if (theToOverrideDefaults
|
||||
&& !myHasOwnPointAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0);
|
||||
myHasOwnPointAspect = true;
|
||||
if (!myLink.IsNull())
|
||||
@@ -1240,13 +1257,14 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
}
|
||||
|
||||
setAspectProgram (theProgram, myHasOwnPointAspect, myPointAspect);
|
||||
return;
|
||||
return isUpdateNeeded;
|
||||
}
|
||||
case Graphic3d_ASPECT_FILL_AREA:
|
||||
{
|
||||
if (theToOverrideDefaults
|
||||
&& !myHasOwnShadingAspect)
|
||||
{
|
||||
isUpdateNeeded = true;
|
||||
myShadingAspect = new Prs3d_ShadingAspect();
|
||||
myHasOwnShadingAspect = true;
|
||||
if (!myLink.IsNull())
|
||||
@@ -1255,7 +1273,8 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
}
|
||||
}
|
||||
setAspectProgram (theProgram, myHasOwnShadingAspect, myShadingAspect);
|
||||
return;
|
||||
return isUpdateNeeded;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -842,7 +842,8 @@ public:
|
||||
//! @param theAspect the type of primitives
|
||||
//! @param theToOverrideDefaults if true then non-overridden attributes using defaults will be allocated and copied from the Link;
|
||||
//! otherwise, only already customized attributes will be changed
|
||||
Standard_EXPORT void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
|
||||
//! @return TRUE if presentation should be recomputed after creating aspects not previously customized (if theToOverrideDefaults is also TRUE)
|
||||
Standard_EXPORT bool SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
|
||||
const Graphic3d_GroupAspect theAspect,
|
||||
const bool theToOverrideDefaults = false);
|
||||
|
||||
|
Reference in New Issue
Block a user