1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024192: Adding support for shaders to OCCT visualization toolkit

This commit is contained in:
apl
2013-10-21 11:47:10 +04:00
committed by abv
parent 30bf45dc70
commit 30f0ad2866
66 changed files with 6117 additions and 404 deletions

View File

@@ -28,6 +28,7 @@
#include <TCollection_AsciiString.hxx>
#include <OpenGl_Element.hxx>
#include <Handle_OpenGl_ShaderProgram.hxx>
//! Text representation parameters
class OpenGl_AspectText : public OpenGl_Element
@@ -118,19 +119,56 @@ public:
return mySubtitleColor;
}
//! Init and return OpenGl shader program resource.
//! @return shader program resource.
const Handle(OpenGl_ShaderProgram)& ShaderProgramRes (const Handle(OpenGl_Workspace)& theWorkspace) const
{
if (!myResources.IsShaderReady())
{
myResources.BuildShader (theWorkspace, myShaderProgram);
myResources.SetShaderReady();
}
return myResources.ShaderProgram;
}
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext);
protected:
TCollection_AsciiString myFont;
TEL_COLOUR myColor;
TEL_COLOUR mySubtitleColor;
float myAngle;
Aspect_TypeOfStyleText myStyleType;
Aspect_TypeOfDisplayText myDisplayType;
Font_FontAspect myFontAspect;
bool myZoomable;
TCollection_AsciiString myFont;
TEL_COLOUR myColor;
TEL_COLOUR mySubtitleColor;
float myAngle;
Aspect_TypeOfStyleText myStyleType;
Aspect_TypeOfDisplayText myDisplayType;
Font_FontAspect myFontAspect;
bool myZoomable;
Handle(Graphic3d_ShaderProgram) myShaderProgram;
protected:
//! OpenGl resources
mutable struct Resources
{
public:
Resources() : myIsShaderReady (Standard_False) {}
Standard_Boolean IsShaderReady() const { return myIsShaderReady; }
void SetShaderReady() { myIsShaderReady = Standard_True; }
void ResetShader () { myIsShaderReady = Standard_False; }
void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader);
Handle(OpenGl_ShaderProgram) ShaderProgram;
TCollection_AsciiString ShaderProgramId;
private:
Standard_Boolean myIsShaderReady;
} myResources;
public: