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:
Desour
2024-03-20 19:35:52 +01:00
parent eb4dec46c2
commit 2bf1d12353
292 changed files with 37376 additions and 42421 deletions

View File

@ -19,29 +19,28 @@ namespace scene
class COBJMeshFileLoader : public IMeshLoader
{
public:
//! Constructor
COBJMeshFileLoader(scene::ISceneManager* smgr);
COBJMeshFileLoader(scene::ISceneManager *smgr);
//! destructor
virtual ~COBJMeshFileLoader();
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".obj")
bool isALoadableFileExtension(const io::path& filename) const override;
bool isALoadableFileExtension(const io::path &filename) const override;
//! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed.
//! If you no longer need the mesh, you should call IAnimatedMesh::drop().
//! See IReferenceCounted::drop() for more information.
IAnimatedMesh* createMesh(io::IReadFile* file) override;
IAnimatedMesh *createMesh(io::IReadFile *file) override;
private:
struct SObjMtl
{
SObjMtl() : Meshbuffer(0), Bumpiness (1.0f), Illumination(0),
RecalculateNormals(false)
SObjMtl() :
Meshbuffer(0), Bumpiness(1.0f), Illumination(0),
RecalculateNormals(false)
{
Meshbuffer = new SMeshBuffer();
Meshbuffer->Material.Shininess = 0.0f;
@ -50,10 +49,10 @@ private:
Meshbuffer->Material.SpecularColor = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f).toSColor();
}
SObjMtl(const SObjMtl& o)
: Name(o.Name), Group(o.Group),
Bumpiness(o.Bumpiness), Illumination(o.Illumination),
RecalculateNormals(false)
SObjMtl(const SObjMtl &o) :
Name(o.Name), Group(o.Group),
Bumpiness(o.Bumpiness), Illumination(o.Illumination),
RecalculateNormals(false)
{
Meshbuffer = new SMeshBuffer();
Meshbuffer->Material = o.Meshbuffer->Material;
@ -69,41 +68,41 @@ private:
};
// returns a pointer to the first printable character available in the buffer
const c8* goFirstWord(const c8* buf, const c8* const bufEnd, bool acrossNewlines=true);
const c8 *goFirstWord(const c8 *buf, const c8 *const bufEnd, bool acrossNewlines = true);
// returns a pointer to the first printable character after the first non-printable
const c8* goNextWord(const c8* buf, const c8* const bufEnd, bool acrossNewlines=true);
const c8 *goNextWord(const c8 *buf, const c8 *const bufEnd, bool acrossNewlines = true);
// returns a pointer to the next printable character after the first line break
const c8* goNextLine(const c8* buf, const c8* const bufEnd);
const c8 *goNextLine(const c8 *buf, const c8 *const bufEnd);
// copies the current word from the inBuf to the outBuf
u32 copyWord(c8* outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
u32 copyWord(c8 *outBuf, const c8 *inBuf, u32 outBufLength, const c8 *const pBufEnd);
// copies the current line from the inBuf to the outBuf
core::stringc copyLine(const c8* inBuf, const c8* const bufEnd);
core::stringc copyLine(const c8 *inBuf, const c8 *const bufEnd);
// combination of goNextWord followed by copyWord
const c8* goAndCopyNextWord(c8* outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
const c8 *goAndCopyNextWord(c8 *outBuf, const c8 *inBuf, u32 outBufLength, const c8 *const pBufEnd);
//! Find and return the material with the given name
SObjMtl* findMtl(const core::stringc& mtlName, const core::stringc& grpName);
SObjMtl *findMtl(const core::stringc &mtlName, const core::stringc &grpName);
//! Read RGB color
const c8* readColor(const c8* bufPtr, video::SColor& color, const c8* const pBufEnd);
const c8 *readColor(const c8 *bufPtr, video::SColor &color, const c8 *const pBufEnd);
//! Read 3d vector of floats
const c8* readVec3(const c8* bufPtr, core::vector3df& vec, const c8* const pBufEnd);
const c8 *readVec3(const c8 *bufPtr, core::vector3df &vec, const c8 *const pBufEnd);
//! Read 2d vector of floats
const c8* readUV(const c8* bufPtr, core::vector2df& vec, const c8* const pBufEnd);
const c8 *readUV(const c8 *bufPtr, core::vector2df &vec, const c8 *const pBufEnd);
//! Read boolean value represented as 'on' or 'off'
const c8* readBool(const c8* bufPtr, bool& tf, const c8* const bufEnd);
const c8 *readBool(const c8 *bufPtr, bool &tf, const c8 *const bufEnd);
// reads and convert to integer the vertex indices in a line of obj file's face statement
// -1 for the index if it doesn't exist
// indices are changed to 0-based index instead of 1-based from the obj file
bool retrieveVertexIndices(c8* vertexData, s32* idx, const c8* bufEnd, u32 vbsize, u32 vtsize, u32 vnsize);
bool retrieveVertexIndices(c8 *vertexData, s32 *idx, const c8 *bufEnd, u32 vbsize, u32 vtsize, u32 vnsize);
void cleanUp();
scene::ISceneManager* SceneManager;
scene::ISceneManager *SceneManager;
core::array<SObjMtl*> Materials;
core::array<SObjMtl *> Materials;
};
} // end namespace scene