mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
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.
84 lines
3.6 KiB
Plaintext
84 lines
3.6 KiB
Plaintext
// This file has been automatically generated from resource file src/Shaders/RaytraceSmooth.fs
|
|
|
|
static const char Shaders_RaytraceSmooth_fs[] =
|
|
"//! Input ray-traced image.\n"
|
|
"uniform sampler2D uFSAAInputTexture;\n"
|
|
"\n"
|
|
"//! Number of accumulated FSAA samples.\n"
|
|
"uniform int uSamples;\n"
|
|
"\n"
|
|
"//! Output pixel color.\n"
|
|
"out vec4 OutColor;\n"
|
|
"\n"
|
|
"#define LUM_DIFFERENCE 0.085f\n"
|
|
"\n"
|
|
"// =======================================================================\n"
|
|
"// function : main\n"
|
|
"// purpose :\n"
|
|
"// =======================================================================\n"
|
|
"void main (void)\n"
|
|
"{\n"
|
|
"#ifndef PATH_TRACING\n"
|
|
"\n"
|
|
" int aPixelX = int (gl_FragCoord.x);\n"
|
|
" int aPixelY = int (gl_FragCoord.y);\n"
|
|
"\n"
|
|
" // Adjust FLIPTRI pattern used for adaptive FSAA\n"
|
|
" float anOffsetX = mix (uOffsetX, -uOffsetX, float (aPixelX % 2));\n"
|
|
" float anOffsetY = mix (uOffsetY, -uOffsetY, float (aPixelY % 2));\n"
|
|
"\n"
|
|
" vec4 aClr0 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY + 0), 0);\n"
|
|
" vec4 aClr1 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY - 1), 0);\n"
|
|
" vec4 aClr2 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY + 1), 0);\n"
|
|
"\n"
|
|
" vec4 aClr3 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 1, aPixelY + 0), 0);\n"
|
|
" vec4 aClr4 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 1, aPixelY - 1), 0);\n"
|
|
" vec4 aClr5 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 1, aPixelY + 1), 0);\n"
|
|
"\n"
|
|
" vec4 aClr6 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX - 1, aPixelY + 0), 0);\n"
|
|
" vec4 aClr7 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX - 1, aPixelY - 1), 0);\n"
|
|
" vec4 aClr8 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX - 1, aPixelY + 1), 0);\n"
|
|
"\n"
|
|
" float aLum = dot (LUMA, aClr0.xyz);\n"
|
|
"\n"
|
|
" bool aRender = abs (aClr1.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr2.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr3.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr4.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr5.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr6.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr7.w - aClr0.w) > LUM_DIFFERENCE ||\n"
|
|
" abs (aClr8.w - aClr0.w) > LUM_DIFFERENCE;\n"
|
|
"\n"
|
|
" if (!aRender)\n"
|
|
" {\n"
|
|
" aRender = abs (dot (LUMA, aClr1.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr2.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr3.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr4.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr5.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr6.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr7.xyz) - aLum) > LUM_DIFFERENCE ||\n"
|
|
" abs (dot (LUMA, aClr8.xyz) - aLum) > LUM_DIFFERENCE;\n"
|
|
" }\n"
|
|
"\n"
|
|
" vec4 aColor = aClr0;\n"
|
|
"\n"
|
|
" if (aRender)\n"
|
|
" {\n"
|
|
" SRay aRay = GenerateRay (vPixel + vec2 (anOffsetX, anOffsetY));\n"
|
|
"\n"
|
|
" vec3 aInvDirect = 1.f / max (abs (aRay.Direct), SMALL);\n"
|
|
"\n"
|
|
" aInvDirect = vec3 (aRay.Direct.x < 0.f ? -aInvDirect.x : aInvDirect.x,\n"
|
|
" aRay.Direct.y < 0.f ? -aInvDirect.y : aInvDirect.y,\n"
|
|
" aRay.Direct.z < 0.f ? -aInvDirect.z : aInvDirect.z);\n"
|
|
"\n"
|
|
" aColor = mix (aClr0, clamp (Radiance (aRay, aInvDirect), 0.f, 1.f), 1.f / uSamples);\n"
|
|
" }\n"
|
|
"\n"
|
|
" OutColor = aColor;\n"
|
|
"\n"
|
|
"#endif\n"
|
|
"}\n";
|