mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0027258: Configuration - generate built-in replacement for mandatory resource files
Generation of header files from resource files was added to CMake and genproj procedures. Message_MsgFile has been extended with new method ::LoadFromString() for loading messages from embedded resources. Message_MsgFile::LoadFromString() is now a preferred way for loading message resources by application as alternative to environment variables. TObje/TObj.msg is now embedded into TObj_Application.cxx. TObj_Application now loads its global messages on instantiation of the first class instance. UnitsAPI/Lexi_Expr.dat now completely embedded into Units_Lexicon.cxx. UnitsAPI/Units.dat now embedded into Units_UnitsDictionary.cxx but can be regenerated from resource file. The definition of the following units have been removed: benne à charbon, calorie (diététique). Unused message files XSMessage/IGES.us and IGES.fr have been removed. Related code IGESData.cxx has been removed as well. XSMessage/XSTEP.us is now embedded into Interface_StaticStandards.cxx and used for fallback initialization in case when file resources defined by CSF_XSMessage environment variable are missing. SHMessage/SHAPE.us is now embedded into ShapeExtend.cxx and used for fallback initialization in case when file resources defined by CSF_XHMessage environment variable are missing. Duplicating code has been removed from ShapeProcess_OperLibrary.cxx. Shaders/Declarations.glsl and Shaders/DeclarationsImpl.glsl are now embedded into OpenGl_ShaderProgram.cxx. CSF_ShadersDirectory is no more required for using OCCT 3D Viewer. Ray-Tracing GLSL programs from Shaders are now embedded into OpenGl_View_Raytrace.cxx. File resources are still used instead of embedded programs when CSF_ShadersDirectory is defined, but this functionality is intended for OCCT development. Enumeration Graphic3d_ShaderProgram::ShaderName_Phong demonstrating custom GLSL program usage has been removed.
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
|
||||
#include <OpenGl_GlCore32.hxx>
|
||||
|
||||
#include "../Shaders/Shaders_DeclarationsImpl_glsl.pxx"
|
||||
#include "../Shaders/Shaders_Declarations_glsl.pxx"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h> // for alloca()
|
||||
#endif
|
||||
@@ -146,33 +149,13 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
OSD_File aDeclFile (Graphic3d_ShaderProgram::ShadersFolder() + "/Declarations.glsl");
|
||||
OSD_File aDeclImplFile (Graphic3d_ShaderProgram::ShadersFolder() + "/DeclarationsImpl.glsl");
|
||||
if (!aDeclFile.Exists()
|
||||
|| !aDeclImplFile.Exists())
|
||||
{
|
||||
const TCollection_ExtendedString aMsg = "Error! Failed to load OCCT shader declarations file";
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_ERROR,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aHeader = !myProxy.IsNull() && !myProxy->Header().IsEmpty()
|
||||
? (myProxy->Header() + "\n")
|
||||
: TCollection_AsciiString();
|
||||
|
||||
TCollection_AsciiString aDeclarations;
|
||||
aDeclFile.Open (OSD_ReadOnly, OSD_Protection());
|
||||
aDeclFile.Read (aDeclarations, (int)aDeclFile.Size());
|
||||
aDeclFile.Close();
|
||||
TCollection_AsciiString aDeclarations = Shaders_Declarations_glsl;
|
||||
TCollection_AsciiString aDeclImpl = Shaders_DeclarationsImpl_glsl;
|
||||
|
||||
TCollection_AsciiString aDeclImpl;
|
||||
aDeclImplFile.Open (OSD_ReadOnly, OSD_Protection());
|
||||
aDeclImplFile.Read (aDeclImpl, (int)aDeclImplFile.Size());
|
||||
aDeclImplFile.Close();
|
||||
aDeclarations += aDeclImpl;
|
||||
|
||||
for (Graphic3d_ShaderObjectList::Iterator anIter (theShaders);
|
||||
|
Reference in New Issue
Block a user