Reformat the code, using:
find -type f | # list all regular files grep -E '\.(h|cpp|mm)$' | # filter for source files grep -v '/mt_' | # filter out generated files grep -v '/vendor/' | # and vendored GL grep -v '/test/image_loader_test.cpp' | # and this file (has giant literals arrays) xargs -n 1 -P $(nproc) clang-format -i # reformat everything Co-authored-by: numzero <numzer0@yandex.ru>
This commit is contained in:
@@ -15,14 +15,14 @@ namespace video
|
||||
// Base callback
|
||||
|
||||
COpenGL3MaterialBaseCB::COpenGL3MaterialBaseCB() :
|
||||
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1),
|
||||
FogEnableID(-1), FogTypeID(-1), FogColorID(-1), FogStartID(-1),
|
||||
FogEndID(-1), FogDensityID(-1), ThicknessID(-1), LightEnable(false), MaterialAmbient(SColorf(0.f, 0.f, 0.f)), MaterialDiffuse(SColorf(0.f, 0.f, 0.f)), MaterialEmissive(SColorf(0.f, 0.f, 0.f)), MaterialSpecular(SColorf(0.f, 0.f, 0.f)),
|
||||
MaterialShininess(0.f), FogEnable(0), FogType(1), FogColor(SColorf(0.f, 0.f, 0.f, 1.f)), FogStart(0.f), FogEnd(0.f), FogDensity(0.f), Thickness(1.f)
|
||||
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1),
|
||||
FogEnableID(-1), FogTypeID(-1), FogColorID(-1), FogStartID(-1),
|
||||
FogEndID(-1), FogDensityID(-1), ThicknessID(-1), LightEnable(false), MaterialAmbient(SColorf(0.f, 0.f, 0.f)), MaterialDiffuse(SColorf(0.f, 0.f, 0.f)), MaterialEmissive(SColorf(0.f, 0.f, 0.f)), MaterialSpecular(SColorf(0.f, 0.f, 0.f)),
|
||||
MaterialShininess(0.f), FogEnable(0), FogType(1), FogColor(SColorf(0.f, 0.f, 0.f, 1.f)), FogStart(0.f), FogEnd(0.f), FogDensity(0.f), Thickness(1.f)
|
||||
{
|
||||
}
|
||||
|
||||
void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial& material)
|
||||
void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial &material)
|
||||
{
|
||||
LightEnable = material.Lighting;
|
||||
MaterialAmbient = SColorf(material.AmbientColor);
|
||||
@@ -36,12 +36,11 @@ void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial& material)
|
||||
Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
|
||||
}
|
||||
|
||||
void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
|
||||
void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices *services, s32 userData)
|
||||
{
|
||||
IVideoDriver* driver = services->getVideoDriver();
|
||||
IVideoDriver *driver = services->getVideoDriver();
|
||||
|
||||
if (FirstUpdateBase)
|
||||
{
|
||||
if (FirstUpdateBase) {
|
||||
WVPMatrixID = services->getVertexShaderConstantID("uWVPMatrix");
|
||||
WVMatrixID = services->getVertexShaderConstantID("uWVMatrix");
|
||||
NMatrixID = services->getVertexShaderConstantID("uNMatrix");
|
||||
@@ -72,8 +71,7 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services,
|
||||
|
||||
services->setPixelShaderConstant(FogEnableID, &FogEnable, 1);
|
||||
|
||||
if (FogEnable)
|
||||
{
|
||||
if (FogEnable) {
|
||||
SColor TempColor(0);
|
||||
E_FOG_TYPE TempType = EFT_FOG_LINEAR;
|
||||
bool TempPerFragment = false;
|
||||
@@ -85,7 +83,7 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services,
|
||||
FogColor = SColorf(TempColor);
|
||||
|
||||
services->setPixelShaderConstant(FogTypeID, &FogType, 1);
|
||||
services->setPixelShaderConstant(FogColorID, reinterpret_cast<f32*>(&FogColor), 4);
|
||||
services->setPixelShaderConstant(FogColorID, reinterpret_cast<f32 *>(&FogColor), 4);
|
||||
services->setPixelShaderConstant(FogStartID, &FogStart, 1);
|
||||
services->setPixelShaderConstant(FogEndID, &FogEnd, 1);
|
||||
services->setPixelShaderConstant(FogDensityID, &FogDensity, 1);
|
||||
@@ -97,11 +95,11 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services,
|
||||
// EMT_SOLID + EMT_TRANSPARENT_ALPHA_CHANNEL + EMT_TRANSPARENT_VERTEX_ALPHA
|
||||
|
||||
COpenGL3MaterialSolidCB::COpenGL3MaterialSolidCB() :
|
||||
FirstUpdate(true), TMatrix0ID(-1), AlphaRefID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), AlphaRef(0.5f), TextureUsage0(0), TextureUnit0(0)
|
||||
FirstUpdate(true), TMatrix0ID(-1), AlphaRefID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), AlphaRef(0.5f), TextureUsage0(0), TextureUnit0(0)
|
||||
{
|
||||
}
|
||||
|
||||
void COpenGL3MaterialSolidCB::OnSetMaterial(const SMaterial& material)
|
||||
void COpenGL3MaterialSolidCB::OnSetMaterial(const SMaterial &material)
|
||||
{
|
||||
COpenGL3MaterialBaseCB::OnSetMaterial(material);
|
||||
|
||||
@@ -109,14 +107,13 @@ void COpenGL3MaterialSolidCB::OnSetMaterial(const SMaterial& material)
|
||||
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
|
||||
}
|
||||
|
||||
void COpenGL3MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
|
||||
void COpenGL3MaterialSolidCB::OnSetConstants(IMaterialRendererServices *services, s32 userData)
|
||||
{
|
||||
COpenGL3MaterialBaseCB::OnSetConstants(services, userData);
|
||||
|
||||
IVideoDriver* driver = services->getVideoDriver();
|
||||
IVideoDriver *driver = services->getVideoDriver();
|
||||
|
||||
if (FirstUpdate)
|
||||
{
|
||||
if (FirstUpdate) {
|
||||
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
|
||||
AlphaRefID = services->getVertexShaderConstantID("uAlphaRef");
|
||||
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
|
||||
@@ -136,29 +133,25 @@ void COpenGL3MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services
|
||||
// EMT_ONETEXTURE_BLEND
|
||||
|
||||
COpenGL3MaterialOneTextureBlendCB::COpenGL3MaterialOneTextureBlendCB() :
|
||||
FirstUpdate(true), TMatrix0ID(-1), BlendTypeID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), BlendType(0), TextureUsage0(0), TextureUnit0(0)
|
||||
FirstUpdate(true), TMatrix0ID(-1), BlendTypeID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), BlendType(0), TextureUsage0(0), TextureUnit0(0)
|
||||
{
|
||||
}
|
||||
|
||||
void COpenGL3MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial& material)
|
||||
void COpenGL3MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial &material)
|
||||
{
|
||||
COpenGL3MaterialBaseCB::OnSetMaterial(material);
|
||||
|
||||
BlendType = 0;
|
||||
|
||||
E_BLEND_FACTOR srcRGBFact,dstRGBFact,srcAlphaFact,dstAlphaFact;
|
||||
E_BLEND_FACTOR srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact;
|
||||
E_MODULATE_FUNC modulate;
|
||||
u32 alphaSource;
|
||||
unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulate, alphaSource, material.MaterialTypeParam);
|
||||
|
||||
if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) || textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact))
|
||||
{
|
||||
if (alphaSource == EAS_VERTEX_COLOR)
|
||||
{
|
||||
if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) || textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact)) {
|
||||
if (alphaSource == EAS_VERTEX_COLOR) {
|
||||
BlendType = 1;
|
||||
}
|
||||
else if (alphaSource == EAS_TEXTURE)
|
||||
{
|
||||
} else if (alphaSource == EAS_TEXTURE) {
|
||||
BlendType = 2;
|
||||
}
|
||||
}
|
||||
@@ -166,14 +159,13 @@ void COpenGL3MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial& material)
|
||||
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
|
||||
}
|
||||
|
||||
void COpenGL3MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
|
||||
void COpenGL3MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices *services, s32 userData)
|
||||
{
|
||||
COpenGL3MaterialBaseCB::OnSetConstants(services, userData);
|
||||
|
||||
IVideoDriver* driver = services->getVideoDriver();
|
||||
IVideoDriver *driver = services->getVideoDriver();
|
||||
|
||||
if (FirstUpdate)
|
||||
{
|
||||
if (FirstUpdate) {
|
||||
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
|
||||
BlendTypeID = services->getVertexShaderConstantID("uBlendType");
|
||||
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
|
||||
|
Reference in New Issue
Block a user