Merge branch 'disable_clang_format_for_osg' into 'master'

Disable clang-format for files that should have minimal diff with OSG

See merge request OpenMW/openmw!2399
make_linux_ci_do_zoomies
psi29a 2 years ago
commit 675c0f9b31

@ -1,3 +1,4 @@
// clang-format off
/* This file is based on OpenSceneGraph's src/osgShadow/ViewDependentShadowMap.cpp. /* This file is based on OpenSceneGraph's src/osgShadow/ViewDependentShadowMap.cpp.
* Where applicable, any changes made are covered by OpenMW's GPL 3 license, not the OSGPL. * Where applicable, any changes made are covered by OpenMW's GPL 3 license, not the OSGPL.
* The original copyright notice is listed below. * The original copyright notice is listed below.
@ -42,159 +43,127 @@ using namespace SceneUtil;
// fragment shader // fragment shader
// //
#if 0 #if 0
const std::string fragmentShaderSource_withBaseTexture = R"glsl( static const char fragmentShaderSource_withBaseTexture[] =
uniform sampler2D baseTexture; "uniform sampler2D baseTexture; \n"
uniform sampler2DShadow shadowTexture; "uniform sampler2DShadow shadowTexture; \n"
" \n"
void main(void) "void main(void) \n"
{ "{ \n"
vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor; " vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor; \n"
vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy ); " vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy ); \n"
color *= mix( colorAmbientEmissive, gl_Color, shadow2DProj( shadowTexture, gl_TexCoord[1] ).r ); " color *= mix( colorAmbientEmissive, gl_Color, shadow2DProj( shadowTexture, gl_TexCoord[1] ).r ); \n"
gl_FragColor = color; " gl_FragColor = color; \n"
} "} \n";
)glsl";
#else #else
const std::string fragmentShaderSource_withBaseTexture = R"glsl( static const char fragmentShaderSource_withBaseTexture[] =
uniform sampler2D baseTexture; "uniform sampler2D baseTexture; \n"
uniform int baseTextureUnit; "uniform int baseTextureUnit; \n"
uniform sampler2DShadow shadowTexture0; "uniform sampler2DShadow shadowTexture0; \n"
uniform int shadowTextureUnit0; "uniform int shadowTextureUnit0; \n"
" \n"
void main(void) "void main(void) \n"
{ "{ \n"
vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor; " vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor; \n"
vec4 color = texture2D( baseTexture, gl_TexCoord[baseTextureUnit].xy ); " vec4 color = texture2D( baseTexture, gl_TexCoord[baseTextureUnit].xy ); \n"
color *= mix( colorAmbientEmissive, gl_Color, shadow2DProj( shadowTexture0, gl_TexCoord[shadowTextureUnit0] ).r ); " color *= mix( colorAmbientEmissive, gl_Color, shadow2DProj( shadowTexture0, gl_TexCoord[shadowTextureUnit0] ).r ); \n"
gl_FragColor = color; " gl_FragColor = color; \n"
} "} \n";
)glsl";
static const char fragmentShaderSource_withBaseTexture_twoShadowMaps[] =
const std::string fragmentShaderSource_withBaseTexture_twoShadowMaps = R"glsl( "uniform sampler2D baseTexture; \n"
uniform sampler2D baseTexture; "uniform int baseTextureUnit; \n"
uniform int baseTextureUnit; "uniform sampler2DShadow shadowTexture0; \n"
uniform sampler2DShadow shadowTexture0; "uniform int shadowTextureUnit0; \n"
uniform int shadowTextureUnit0; "uniform sampler2DShadow shadowTexture1; \n"
uniform sampler2DShadow shadowTexture1; "uniform int shadowTextureUnit1; \n"
uniform int shadowTextureUnit1; " \n"
"void main(void) \n"
void main(void) "{ \n"
{ " vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor; \n"
vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor; " vec4 color = texture2D( baseTexture, gl_TexCoord[baseTextureUnit].xy ); \n"
vec4 color = texture2D( baseTexture, gl_TexCoord[baseTextureUnit].xy ); " float shadow0 = shadow2DProj( shadowTexture0, gl_TexCoord[shadowTextureUnit0] ).r; \n"
float shadow0 = shadow2DProj( shadowTexture0, gl_TexCoord[shadowTextureUnit0] ).r; " float shadow1 = shadow2DProj( shadowTexture1, gl_TexCoord[shadowTextureUnit1] ).r; \n"
float shadow1 = shadow2DProj( shadowTexture1, gl_TexCoord[shadowTextureUnit1] ).r; " color *= mix( colorAmbientEmissive, gl_Color, shadow0*shadow1 ); \n"
color *= mix( colorAmbientEmissive, gl_Color, shadow0*shadow1 ); " gl_FragColor = color; \n"
gl_FragColor = color; "} \n";
}
)glsl";
#endif #endif
const std::string debugVertexShaderSource = R"glsl( std::string debugVertexShaderSource = "void main(void){gl_Position = gl_Vertex; gl_TexCoord[0]=gl_MultiTexCoord0;}";
void main(void) std::string debugFragmentShaderSource =
{ "uniform sampler2D texture; \n"
gl_Position = gl_Vertex; " \n"
gl_TexCoord[0] = gl_MultiTexCoord0; "void main(void) \n"
} "{ \n"
)glsl";
const std::string debugFragmentShaderSource = R"glsl(
uniform sampler2D texture;
void main(void)
{
)glsl"
#if 1 #if 1
R"glsl( " float f = texture2D(texture, gl_TexCoord[0].xy).r; \n"
float f = texture2D(texture, gl_TexCoord[0].xy).r; " \n"
" f = 256.0 * f; \n"
f = 256.0 * f; " float fC = floor( f ) / 256.0; \n"
float fC = floor( f ) / 256.0; " \n"
" f = 256.0 * fract( f ); \n"
f = 256.0 * fract( f ); " float fS = floor( f ) / 256.0; \n"
float fS = floor( f ) / 256.0; " \n"
" f = 256.0 * fract( f ); \n"
f = 256.0 * fract( f ); " float fH = floor( f ) / 256.0; \n"
float fH = floor( f ) / 256.0; " \n"
" fS *= 0.5; \n"
fS *= 0.5; " fH = ( fH * 0.34 + 0.66 ) * ( 1.0 - fS ); \n"
fH = ( fH * 0.34 + 0.66 ) * ( 1.0 - fS ); " \n"
" vec3 rgb = vec3( ( fC > 0.5 ? ( 1.0 - fC ) : fC ), \n"
vec3 rgb = vec3( ( fC > 0.5 ? ( 1.0 - fC ) : fC ), " abs( fC - 0.333333 ), \n"
abs( fC - 0.333333 ), " abs( fC - 0.666667 ) ); \n"
abs( fC - 0.666667 ) ); " \n"
" rgb = min( vec3( 1.0, 1.0, 1.0 ), 3.0 * rgb ); \n"
rgb = min( vec3( 1.0, 1.0, 1.0 ), 3.0 * rgb ); " \n"
" float fMax = max( max( rgb.r, rgb.g ), rgb.b ); \n"
float fMax = max( max( rgb.r, rgb.g ), rgb.b ); " fMax = 1.0 / fMax; \n"
fMax = 1.0 / fMax; " \n"
" vec3 color = fMax * rgb; \n"
vec3 color = fMax * rgb; " \n"
" gl_FragColor = vec4( fS + fH * color, 1 ); \n"
gl_FragColor = vec4( fS + fH * color, 1 );
)glsl"
#else #else
R"glsl( " gl_FragColor = texture2D(texture, gl_TexCoord[0].xy); \n"
gl_FragColor = texture2D(texture, gl_TexCoord[0].xy);
)glsl"
#endif #endif
R"glsl( "} \n";
}
)glsl"; std::string debugFrustumVertexShaderSource = "varying float depth; uniform mat4 transform; void main(void){gl_Position = transform * gl_Vertex; depth = gl_Position.z / gl_Position.w;}";
std::string debugFrustumFragmentShaderSource =
const std::string debugFrustumVertexShaderSource = R"glsl( "varying float depth; \n"
varying float depth; " \n"
uniform mat4 transform; "void main(void) \n"
void main(void) "{ \n"
{
gl_Position = transform * gl_Vertex;
depth = gl_Position.z / gl_Position.w;
}
)glsl";
const std::string debugFrustumFragmentShaderSource = R"glsl(
varying float depth;
void main(void)
{
)glsl"
#if 1 #if 1
R"glsl( " float f = depth; \n"
float f = depth; " \n"
" f = 256.0 * f; \n"
f = 256.0 * f; " float fC = floor( f ) / 256.0; \n"
float fC = floor( f ) / 256.0; " \n"
" f = 256.0 * fract( f ); \n"
f = 256.0 * fract( f ); " float fS = floor( f ) / 256.0; \n"
float fS = floor( f ) / 256.0; " \n"
" f = 256.0 * fract( f ); \n"
f = 256.0 * fract( f ); " float fH = floor( f ) / 256.0; \n"
float fH = floor( f ) / 256.0; " \n"
" fS *= 0.5; \n"
fS *= 0.5; " fH = ( fH * 0.34 + 0.66 ) * ( 1.0 - fS ); \n"
fH = ( fH * 0.34 + 0.66 ) * ( 1.0 - fS ); " \n"
" vec3 rgb = vec3( ( fC > 0.5 ? ( 1.0 - fC ) : fC ), \n"
vec3 rgb = vec3( ( fC > 0.5 ? ( 1.0 - fC ) : fC ), " abs( fC - 0.333333 ), \n"
abs( fC - 0.333333 ), " abs( fC - 0.666667 ) ); \n"
abs( fC - 0.666667 ) ); " \n"
" rgb = min( vec3( 1.0, 1.0, 1.0 ), 3.0 * rgb ); \n"
rgb = min( vec3( 1.0, 1.0, 1.0 ), 3.0 * rgb ); " \n"
" float fMax = max( max( rgb.r, rgb.g ), rgb.b ); \n"
float fMax = max( max( rgb.r, rgb.g ), rgb.b ); " fMax = 1.0 / fMax; \n"
fMax = 1.0 / fMax; " \n"
" vec3 color = fMax * rgb; \n"
vec3 color = fMax * rgb; " \n"
" gl_FragColor = vec4( fS + fH * color, 1 ); \n"
gl_FragColor = vec4( fS + fH * color, 1 );
)glsl"
#else #else
R"glsl( " gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0); \n"
gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);
)glsl"
#endif #endif
R"glsl( "} \n";
}
)glsl";
template<class T> template<class T>
class RenderLeafTraverser : public T class RenderLeafTraverser : public T
@ -3413,3 +3382,4 @@ osg::ref_ptr<osg::StateSet> SceneUtil::MWShadowTechnique::getOrCreateShadowsBinS
} }
return _shadowsBinStateSet; return _shadowsBinStateSet;
} }
// clang-format on

@ -1,3 +1,4 @@
// clang-format off
/* This file is based on OpenSceneGraph's include/osgShadow/ViewDependentShadowMap. /* This file is based on OpenSceneGraph's include/osgShadow/ViewDependentShadowMap.
* Where applicable, any changes made are covered by OpenMW's GPL 3 license, not the OSGPL. * Where applicable, any changes made are covered by OpenMW's GPL 3 license, not the OSGPL.
* The original copyright notice is listed below. * The original copyright notice is listed below.
@ -336,3 +337,4 @@ namespace SceneUtil {
} }
#endif #endif
// clang-format on

@ -1,3 +1,4 @@
// clang-format off
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
@ -1976,3 +1977,4 @@ void Optimizer::MergeGroupsVisitor::apply(osg::Group &group)
} }
} }
// clang-format on

@ -1,3 +1,4 @@
// clang-format off
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
@ -468,3 +469,4 @@ inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Nod
} }
#endif #endif
// clang-format on

Loading…
Cancel
Save