Code-style consistency improvement:

Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -5,50 +5,51 @@
#include "geometry.h"
#include "tgaimage.h"
class Model {
class Model
{
private:
std::vector<Vec3f> verts_;
std::vector<std::vector<Vec3i> > faces_; // attention, this Vec3i means vertex/uv/normal
std::vector<Vec3f> norms_;
std::vector<Vec2f> uv_;
TGAImage diffusemap_;
TGAImage normalmap_;
TGAImage specularmap_;
Vec4f m_colorRGBA;
void load_texture(std::string filename, const char *suffix, TGAImage &img);
public:
Model(const char *filename);
Model();
void setColorRGBA(const float rgba[4])
{
for (int i=0;i<4;i++)
m_colorRGBA[i] = rgba[i];
}
const Vec4f& getColorRGBA() const
{
return m_colorRGBA;
}
void loadDiffuseTexture(const char* relativeFileName);
void setDiffuseTextureFromData(unsigned char* textureImage,int textureWidth,int textureHeight);
void reserveMemory(int numVertices, int numIndices);
void addVertex(float x,float y,float z, float normalX, float normalY, float normalZ, float u, float v);
void addTriangle(int vertexposIndex0, int normalIndex0, int uvIndex0,
int vertexposIndex1, int normalIndex1, int uvIndex1,
int vertexposIndex2, int normalIndex2, int uvIndex2);
~Model();
int nverts();
int nfaces();
Vec3f normal(int iface, int nthvert);
Vec3f normal(Vec2f uv);
Vec3f vert(int i);
Vec3f vert(int iface, int nthvert);
Vec2f uv(int iface, int nthvert);
TGAColor diffuse(Vec2f uv);
float specular(Vec2f uv);
std::vector<int> face(int idx);
};
#endif //__MODEL_H__
std::vector<Vec3f> verts_;
std::vector<std::vector<Vec3i> > faces_; // attention, this Vec3i means vertex/uv/normal
std::vector<Vec3f> norms_;
std::vector<Vec2f> uv_;
TGAImage diffusemap_;
TGAImage normalmap_;
TGAImage specularmap_;
Vec4f m_colorRGBA;
void load_texture(std::string filename, const char* suffix, TGAImage& img);
public:
Model(const char* filename);
Model();
void setColorRGBA(const float rgba[4])
{
for (int i = 0; i < 4; i++)
m_colorRGBA[i] = rgba[i];
}
const Vec4f& getColorRGBA() const
{
return m_colorRGBA;
}
void loadDiffuseTexture(const char* relativeFileName);
void setDiffuseTextureFromData(unsigned char* textureImage, int textureWidth, int textureHeight);
void reserveMemory(int numVertices, int numIndices);
void addVertex(float x, float y, float z, float normalX, float normalY, float normalZ, float u, float v);
void addTriangle(int vertexposIndex0, int normalIndex0, int uvIndex0,
int vertexposIndex1, int normalIndex1, int uvIndex1,
int vertexposIndex2, int normalIndex2, int uvIndex2);
~Model();
int nverts();
int nfaces();
Vec3f normal(int iface, int nthvert);
Vec3f normal(Vec2f uv);
Vec3f vert(int i);
Vec3f vert(int iface, int nthvert);
Vec2f uv(int iface, int nthvert);
TGAColor diffuse(Vec2f uv);
float specular(Vec2f uv);
std::vector<int> face(int idx);
};
#endif //__MODEL_H__