From a7407edaf81c685d4a389785a405a53a5de4b148 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 12 May 2020 00:58:40 +0800 Subject: Format EVERYTHING. Hopefully this will make the source code less horrendous and actually readable. The command used was: ``` astyle --suffix=none --style=allman --attach-extern-c --attach-closing-while --indent-switches --indent-after-parens --pad-oper --pad-header --unpad-paren --align-pointer=name --recursive './*.cpp,*.hpp' ``` --- visualization/extrasmeltutils.hpp | 234 ++++++++++++++++++++------------------ 1 file changed, 126 insertions(+), 108 deletions(-) (limited to 'visualization/extrasmeltutils.hpp') diff --git a/visualization/extrasmeltutils.hpp b/visualization/extrasmeltutils.hpp index 3cea3fc..ca36415 100644 --- a/visualization/extrasmeltutils.hpp +++ b/visualization/extrasmeltutils.hpp @@ -13,134 +13,152 @@ #define EPSF 1e-6f class smEntity3D { - friend class smEntity3DBuffer; - private: - std::vector vertices; - std::vector indices; - public: - smEntity3D(){vertices.clear();indices.clear();} - void addVertices(size_t n,...); - void addIndices(size_t n,...); - smVertex vertex(size_t idx)const; - WORD index(size_t idx)const; - void setVertex(size_t idx,smVertex v); - void setIndex(size_t idx,WORD i); - static smEntity3D cube(smvec3d tl,smvec3d br,DWORD color,int faces=63); + friend class smEntity3DBuffer; +private: + std::vector vertices; + std::vector indices; +public: + smEntity3D() + { + vertices.clear(); + indices.clear(); + } + void addVertices(size_t n, ...); + void addIndices(size_t n, ...); + smVertex vertex(size_t idx)const; + WORD index(size_t idx)const; + void setVertex(size_t idx, smVertex v); + void setIndex(size_t idx, WORD i); + static smEntity3D cube(smvec3d tl, smvec3d br, DWORD color, int faces = 63); }; class smEntity3DBuffer { - private: - std::vector vertices; - std::vector indices; - static SMELT* sm; - public: - smEntity3DBuffer(); - ~smEntity3DBuffer(){sm->smRelease();} - void addTransformedEntity(smEntity3D *entity,smMatrix t,smvec3d p); - void drawBatch(); +private: + std::vector vertices; + std::vector indices; + static SMELT *sm; +public: + smEntity3DBuffer(); + ~smEntity3DBuffer() + { + sm->smRelease(); + } + void addTransformedEntity(smEntity3D *entity, smMatrix t, smvec3d p); + void drawBatch(); }; class smColor { - private: - float r,g,b,h,s,v,a; - void update_rgb(); - void update_hsv(); - public: - smColor(); - void clamp(bool hsv); - float alpha()const; - float red()const; - float green()const; - float blue()const; - float hue()const; - float saturation()const; - float hslSaturation()const; - float value()const; - float lightness()const; - void setAlpha(float alpha); - void setRed(float red); - void setGreen(float green); - void setBlue(float blue); - void setHue(float hue); - void setSaturation(float saturation); - void setHSLSaturation(float saturation); - void setValue(float value); - void setLightness(float lightness); - smColor lighter(int factor); - smColor darker(int factor); - uint32_t toHWColor(); - static smColor fromHWColor(uint32_t color); +private: + float r, g, b, h, s, v, a; + void update_rgb(); + void update_hsv(); +public: + smColor(); + void clamp(bool hsv); + float alpha()const; + float red()const; + float green()const; + float blue()const; + float hue()const; + float saturation()const; + float hslSaturation()const; + float value()const; + float lightness()const; + void setAlpha(float alpha); + void setRed(float red); + void setGreen(float green); + void setBlue(float blue); + void setHue(float hue); + void setSaturation(float saturation); + void setHSLSaturation(float saturation); + void setValue(float value); + void setLightness(float lightness); + smColor lighter(int factor); + smColor darker(int factor); + uint32_t toHWColor(); + static smColor fromHWColor(uint32_t color); }; class smPSEmissionPositionGenerator { - public: - virtual smvec3d genPos(){return smvec3d(0,0,0);} +public: + virtual smvec3d genPos() + { + return smvec3d(0, 0, 0); + } }; -class smXLinePSGenerator:public smPSEmissionPositionGenerator +class smXLinePSGenerator: public smPSEmissionPositionGenerator { - private: - smRandomEngine re; - double var; - public: - smXLinePSGenerator(double _var){re.setSeed(time(nullptr));var=_var;} - smvec3d genPos(){return smvec3d(re.nextDouble(-var,var),0,0);} +private: + smRandomEngine re; + double var; +public: + smXLinePSGenerator(double _var) + { + re.setSeed(time(nullptr)); + var = _var; + } + smvec3d genPos() + { + return smvec3d(re.nextDouble(-var, var), 0, 0); + } }; class smParticleSystemInfo { - public: - smvec3d vel,velvar,acc,accvar; - smvec3d rotv,rotvvar,rota,rotavar; - double lifespan,lifespanvar; - int maxcount,emissioncount,ecvar; - double emissiondelay,edvar; - double initsize,initsizevar; - double finalsize,finalsizevar; - DWORD initcolor,initcolorvar; - DWORD finalcolor,finalcolorvar; - SMTEX texture;int blend; +public: + smvec3d vel, velvar, acc, accvar; + smvec3d rotv, rotvvar, rota, rotavar; + double lifespan, lifespanvar; + int maxcount, emissioncount, ecvar; + double emissiondelay, edvar; + double initsize, initsizevar; + double finalsize, finalsizevar; + DWORD initcolor, initcolorvar; + DWORD finalcolor, finalcolorvar; + SMTEX texture; + int blend; }; class smParticle { - friend class smParticleSystem; - private: - static SMELT* sm; - smvec3d pos,rot,lookatpos; - smvec3d vel,accel,rotv,rota; - double lifespan,clifespan; - double initsize,finalsize,size; - DWORD color,initcolor,finalcolor; - smQuad q; - bool dead,lookat; - public: - smParticle(); - ~smParticle(); - void render(); - void update(); + friend class smParticleSystem; +private: + static SMELT *sm; + smvec3d pos, rot, lookatpos; + smvec3d vel, accel, rotv, rota; + double lifespan, clifespan; + double initsize, finalsize, size; + DWORD color, initcolor, finalcolor; + smQuad q; + bool dead, lookat; +public: + smParticle(); + ~smParticle(); + void render(); + void update(); }; class smParticleSystem { - private: - static SMELT* sm; - std::vector particles; - smParticleSystemInfo psinfo; - smvec3d pos,lookatpos; - smRandomEngine re; - smPSEmissionPositionGenerator* posGenerator; - bool active,lookat; - double cemdelay,nemdelay; - public: - smParticleSystem(); - ~smParticleSystem(); - void setParticleSystemInfo(smParticleSystemInfo _psinfo); - void setPos(smvec3d _pos); - void setPSEmissionPosGen(smPSEmissionPositionGenerator* _gen); - void setPSLookAt(smvec3d at); - void unsetPSLookAt(); - void startPS(); - void stopPS(); - void updatePS(); - void renderPS(); +private: + static SMELT *sm; + std::vector particles; + smParticleSystemInfo psinfo; + smvec3d pos, lookatpos; + smRandomEngine re; + smPSEmissionPositionGenerator *posGenerator; + bool active, lookat; + double cemdelay, nemdelay; +public: + smParticleSystem(); + ~smParticleSystem(); + void setParticleSystemInfo(smParticleSystemInfo _psinfo); + void setPos(smvec3d _pos); + void setPSEmissionPosGen(smPSEmissionPositionGenerator *_gen); + void setPSLookAt(smvec3d at); + void unsetPSLookAt(); + void startPS(); + void stopPS(); + void updatePS(); + void renderPS(); }; -extern smVertex makeVertex(float x,float y,float z,DWORD color,float tx,float ty); +extern smVertex makeVertex(float x, float y, float z, DWORD color, float tx, float ty); #endif // EXTRASMELTUTILS_H -- cgit v1.2.3