mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 20:11:13 +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.diffuseColor = glm::vec3(1, 1, 1);
|
||||||
meshPart.specularColor = glm::vec3(1, 1, 1);
|
meshPart.specularColor = glm::vec3(1, 1, 1);
|
||||||
meshPart.emissiveColor = glm::vec3(0, 0, 0);
|
meshPart.emissiveColor = glm::vec3(0, 0, 0);
|
||||||
|
@ -165,21 +165,21 @@ QVector<OBJFace> OBJFace::triangulate() {
|
||||||
}
|
}
|
||||||
return newFaces;
|
return newFaces;
|
||||||
}
|
}
|
||||||
void OBJFace::addFrom(OBJFace const * f, int i) { // add using data from f at index i
|
void OBJFace::addFrom(const OBJFace* face, int index) { // add using data from f at index i
|
||||||
vertexIndices.append(f->vertexIndices[i]);
|
vertexIndices.append(face->vertexIndices[index]);
|
||||||
if (f->textureUVIndices.count() > 0) { // Any at all. Runtime error if not consistent.
|
if (face->textureUVIndices.count() > 0) { // Any at all. Runtime error if not consistent.
|
||||||
textureUVIndices.append(f->textureUVIndices[i]);
|
textureUVIndices.append(face->textureUVIndices[index]);
|
||||||
}
|
}
|
||||||
if (f->normalIndices.count() > 0) {
|
if (face->normalIndices.count() > 0) {
|
||||||
normalIndices.append(f->normalIndices[i]);
|
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;
|
FaceGroup faces;
|
||||||
FBXMesh &mesh = geometry.meshes[0];
|
FBXMesh& mesh = geometry.meshes[0];
|
||||||
mesh.parts.append(FBXMeshPart());
|
mesh.parts.append(FBXMeshPart());
|
||||||
FBXMeshPart &meshPart = mesh.parts.last();
|
FBXMeshPart& meshPart = mesh.parts.last();
|
||||||
bool sawG = false;
|
bool sawG = false;
|
||||||
bool result = true;
|
bool result = true;
|
||||||
int originalFaceCountForDebugging = 0;
|
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.
|
// add a new meshPart to the geometry's single mesh.
|
||||||
while (parseOBJGroup(tokenizer, mapping, geometry, scaleGuess)) {}
|
while (parseOBJGroup(tokenizer, mapping, geometry, scaleGuess)) {}
|
||||||
|
|
||||||
FBXMesh &mesh = geometry.meshes[0];
|
FBXMesh& mesh = geometry.meshes[0];
|
||||||
mesh.meshIndex = 0;
|
mesh.meshIndex = 0;
|
||||||
|
|
||||||
geometry.joints.resize(1);
|
geometry.joints.resize(1);
|
||||||
|
@ -320,7 +320,7 @@ FBXGeometry OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping) {
|
||||||
|
|
||||||
int meshPartCount = 0;
|
int meshPartCount = 0;
|
||||||
for (int i = 0; i < mesh.parts.count(); i++) {
|
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();
|
//qCDebug(modelformat) << "part:" << meshPartCount << " faces:" << faceGroups[meshPartCount].count() << "triangle indices will start with:" << mesh.vertices.count();
|
||||||
foreach(OBJFace face, faceGroups[meshPartCount]) {
|
foreach(OBJFace face, faceGroups[meshPartCount]) {
|
||||||
glm::vec3 v0 = vertices[face.vertexIndices[0]];
|
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.
|
// 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();
|
QVector<OBJFace> triangulate();
|
||||||
private:
|
private:
|
||||||
void addFrom(OBJFace const * f, int i);
|
void addFrom(const OBJFace* face, int index);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OBJReader {
|
class OBJReader {
|
||||||
|
@ -54,5 +54,5 @@ public:
|
||||||
FBXGeometry readOBJ(const QByteArray& model, const QVariantHash& mapping);
|
FBXGeometry readOBJ(const QByteArray& model, const QVariantHash& mapping);
|
||||||
FBXGeometry readOBJ(QIODevice* device, const QVariantHash& mapping);
|
FBXGeometry readOBJ(QIODevice* device, const QVariantHash& mapping);
|
||||||
void fbxDebugDump(const FBXGeometry& fbxgeo);
|
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);
|
fbxgeo = readFBX(_reply, _mapping, grabLightmaps, lightmapLevel);
|
||||||
} else if (_url.path().toLower().endsWith(".obj")) {
|
} else if (_url.path().toLower().endsWith(".obj")) {
|
||||||
fbxgeo = OBJReader().readOBJ(_reply, _mapping);
|
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....
|
if (mesh.texCoords.count() > 0) { // If we have uv texture coordinates....
|
||||||
// ... then ensure that every meshPart has a texture filename.
|
// ... then ensure that every meshPart has a texture filename.
|
||||||
// For now, that's defined directly, using the popular .obj convention that
|
// 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"));
|
QString basename = filename.remove(extIndex + 1, sizeof("obj"));
|
||||||
QByteArray defaultTexture = basename.toUtf8() + "jpg";
|
QByteArray defaultTexture = basename.toUtf8() + "jpg";
|
||||||
//qCDebug(renderutils) << "basename for " << filename << " is " << basename << ", default:" << defaultTexture;
|
//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++) {
|
for (int i = 0; i < meshParts.count(); i++) {
|
||||||
FBXMeshPart & meshPart = meshParts[i];
|
FBXMeshPart& meshPart = meshParts[i];
|
||||||
if (meshPart.diffuseTexture.filename.count() == 0) {
|
if (meshPart.diffuseTexture.filename.count() == 0) {
|
||||||
meshPart.diffuseTexture.filename = defaultTexture;
|
meshPart.diffuseTexture.filename = defaultTexture;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue