mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 22:45:17 +02:00
coding standard: type formatting and variable names
This commit is contained in:
parent
59ed63027b
commit
1255d46140
3 changed files with 17 additions and 17 deletions
|
@ -108,7 +108,7 @@ glm::vec2 OBJTokenizer::getVec2() {
|
|||
}
|
||||
|
||||
|
||||
void setMeshPartDefaults(FBXMeshPart &meshPart, QString materialID) {
|
||||
void setMeshPartDefaults(FBXMeshPart& meshPart, QString materialID) {
|
||||
meshPart.diffuseColor = glm::vec3(1, 1, 1);
|
||||
meshPart.specularColor = glm::vec3(1, 1, 1);
|
||||
meshPart.emissiveColor = glm::vec3(0, 0, 0);
|
||||
|
@ -165,21 +165,21 @@ QVector<OBJFace> OBJFace::triangulate() {
|
|||
}
|
||||
return newFaces;
|
||||
}
|
||||
void OBJFace::addFrom(OBJFace const * f, int i) { // add using data from f at index i
|
||||
vertexIndices.append(f->vertexIndices[i]);
|
||||
if (f->textureUVIndices.count() > 0) { // Any at all. Runtime error if not consistent.
|
||||
textureUVIndices.append(f->textureUVIndices[i]);
|
||||
void OBJFace::addFrom(const OBJFace* face, int index) { // add using data from f at index i
|
||||
vertexIndices.append(face->vertexIndices[index]);
|
||||
if (face->textureUVIndices.count() > 0) { // Any at all. Runtime error if not consistent.
|
||||
textureUVIndices.append(face->textureUVIndices[index]);
|
||||
}
|
||||
if (f->normalIndices.count() > 0) {
|
||||
normalIndices.append(f->normalIndices[i]);
|
||||
if (face->normalIndices.count() > 0) {
|
||||
normalIndices.append(face->normalIndices[index]);
|
||||
}
|
||||
}
|
||||
|
||||
bool OBJReader::parseOBJGroup(OBJTokenizer &tokenizer, const QVariantHash& mapping, FBXGeometry &geometry, float& scaleGuess) {
|
||||
bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mapping, FBXGeometry& geometry, float& scaleGuess) {
|
||||
FaceGroup faces;
|
||||
FBXMesh &mesh = geometry.meshes[0];
|
||||
FBXMesh& mesh = geometry.meshes[0];
|
||||
mesh.parts.append(FBXMeshPart());
|
||||
FBXMeshPart &meshPart = mesh.parts.last();
|
||||
FBXMeshPart& meshPart = mesh.parts.last();
|
||||
bool sawG = false;
|
||||
bool result = true;
|
||||
int originalFaceCountForDebugging = 0;
|
||||
|
@ -292,7 +292,7 @@ FBXGeometry OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping) {
|
|||
// add a new meshPart to the geometry's single mesh.
|
||||
while (parseOBJGroup(tokenizer, mapping, geometry, scaleGuess)) {}
|
||||
|
||||
FBXMesh &mesh = geometry.meshes[0];
|
||||
FBXMesh& mesh = geometry.meshes[0];
|
||||
mesh.meshIndex = 0;
|
||||
|
||||
geometry.joints.resize(1);
|
||||
|
@ -320,7 +320,7 @@ FBXGeometry OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping) {
|
|||
|
||||
int meshPartCount = 0;
|
||||
for (int i = 0; i < mesh.parts.count(); i++) {
|
||||
FBXMeshPart & meshPart = mesh.parts[i];
|
||||
FBXMeshPart& meshPart = mesh.parts[i];
|
||||
//qCDebug(modelformat) << "part:" << meshPartCount << " faces:" << faceGroups[meshPartCount].count() << "triangle indices will start with:" << mesh.vertices.count();
|
||||
foreach(OBJFace face, faceGroups[meshPartCount]) {
|
||||
glm::vec3 v0 = vertices[face.vertexIndices[0]];
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
// Even though FBXMeshPart can handle quads, it would be messy to try to keep track of mixed-size faces, so we treat everything as triangles.
|
||||
QVector<OBJFace> triangulate();
|
||||
private:
|
||||
void addFrom(OBJFace const * f, int i);
|
||||
void addFrom(const OBJFace* face, int index);
|
||||
};
|
||||
|
||||
class OBJReader {
|
||||
|
@ -54,5 +54,5 @@ public:
|
|||
FBXGeometry readOBJ(const QByteArray& model, const QVariantHash& mapping);
|
||||
FBXGeometry readOBJ(QIODevice* device, const QVariantHash& mapping);
|
||||
void fbxDebugDump(const FBXGeometry& fbxgeo);
|
||||
bool parseOBJGroup(OBJTokenizer &tokenizer, const QVariantHash& mapping, FBXGeometry &geometry, float& scaleGuess);
|
||||
bool parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mapping, FBXGeometry& geometry, float& scaleGuess);
|
||||
};
|
||||
|
|
|
@ -2106,7 +2106,7 @@ void GeometryReader::run() {
|
|||
fbxgeo = readFBX(_reply, _mapping, grabLightmaps, lightmapLevel);
|
||||
} else if (_url.path().toLower().endsWith(".obj")) {
|
||||
fbxgeo = OBJReader().readOBJ(_reply, _mapping);
|
||||
FBXMesh & mesh = fbxgeo.meshes[0]; // only one, by construction
|
||||
FBXMesh& mesh = fbxgeo.meshes[0]; // only one, by construction
|
||||
if (mesh.texCoords.count() > 0) { // If we have uv texture coordinates....
|
||||
// ... then ensure that every meshPart has a texture filename.
|
||||
// For now, that's defined directly, using the popular .obj convention that
|
||||
|
@ -2117,9 +2117,9 @@ void GeometryReader::run() {
|
|||
QString basename = filename.remove(extIndex + 1, sizeof("obj"));
|
||||
QByteArray defaultTexture = basename.toUtf8() + "jpg";
|
||||
//qCDebug(renderutils) << "basename for " << filename << " is " << basename << ", default:" << defaultTexture;
|
||||
QVector<FBXMeshPart> & meshParts = mesh.parts;
|
||||
QVector<FBXMeshPart>& meshParts = mesh.parts;
|
||||
for (int i = 0; i < meshParts.count(); i++) {
|
||||
FBXMeshPart & meshPart = meshParts[i];
|
||||
FBXMeshPart& meshPart = meshParts[i];
|
||||
if (meshPart.diffuseTexture.filename.count() == 0) {
|
||||
meshPart.diffuseTexture.filename = defaultTexture;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue