Rename cotangent to bitangent

This commit is contained in:
James Lambert 2022-07-18 21:53:48 -06:00
parent 234c6fa5ee
commit d9d42d05e9
7 changed files with 14 additions and 11 deletions

View file

@ -688,6 +688,9 @@
"type": "string"
}]
}
},
"normalSource": {
"enum": ["normal", "tangent", "-tangent", "bitangent", "-bitangent"]
}
}
}

View file

@ -247,10 +247,10 @@ std::string CFileDefinition::GetVertexBuffer(std::shared_ptr<ExtendedMesh> mesh,
requestedName += "_ntangent";
break;
case VertexType::POSUVCotangent:
requestedName += "_cotangent";
requestedName += "_bitangent";
break;
case VertexType::POSUVMinusCotangent:
requestedName += "_ncotangent";
requestedName += "_nbitangent";
break;
}

View file

@ -47,7 +47,7 @@ VertexType convertNormalSourceToVertexType(NormalSource normalSource) {
return VertexType::POSUVTangent;
case NormalSource::MinusTangent:
return VertexType::POSUVMinusTangent;
case NormalSource::CoTangent:
case NormalSource::Bitangent:
return VertexType::POSUVMinusCotangent;
case NormalSource::MinusCotangent:
return VertexType::POSUVMinusCotangent;

View file

@ -20,7 +20,7 @@ enum class NormalSource {
Normal,
Tangent,
MinusTangent,
CoTangent,
Bitangent,
MinusCotangent,
};

View file

@ -147,10 +147,10 @@ NormalSource parseMaterialNormalSource(const YAML::Node& node) {
if (name == "-tangent") {
return NormalSource::MinusTangent;
}
if (name == "cotangent") {
return NormalSource::CoTangent;
if (name == "bitangent") {
return NormalSource::Bitangent;
}
if (name == "-cotangent") {
if (name == "-bitangent") {
return NormalSource::MinusCotangent;
}
}

View file

@ -110,7 +110,7 @@ void pointLightableMeshInit(struct PointLightableMesh* mesh, Vtx* inputVertices,
mesh->vertexNormals = malloc(sizeof(struct Vector3) * vertexCount);
mesh->vertexTangents = malloc(sizeof(struct Vector3) * vertexCount);
mesh->vertexCoTangents = malloc(sizeof(struct Vector3) * vertexCount);
mesh->vertexBitangents = malloc(sizeof(struct Vector3) * vertexCount);
mesh->oututVertices = malloc(sizeof(Vtx) * vertexCount);
mesh->inputVertices = inputVertices;
mesh->drawCommand = malloc(sizeof(Gfx) * gfxCommandCount);
@ -137,7 +137,7 @@ void pointLightableMeshInit(struct PointLightableMesh* mesh, Vtx* inputVertices,
mesh->oututVertices[i] = mesh->inputVertices[i];
vector3Cross(normal, tangent, &mesh->vertexCoTangents[i]);
vector3Cross(normal, tangent, &mesh->vertexBitangents[i]);
}
Gfx* currGfx = mesh->drawCommand;
@ -172,7 +172,7 @@ void pointLightableCalc(struct PointLightableMesh* mesh, struct Transform* meshT
float perpDistnace = vector3Dot(&mesh->vertexNormals[i], &offset);
float tangentDistnace = vector3Dot(&mesh->vertexTangents[i], &offset);
float coTangentDistnace = vector3Dot(&mesh->vertexCoTangents[i], &offset);
float coTangentDistnace = vector3Dot(&mesh->vertexBitangents[i], &offset);
float uvWorldSize = RENDERED_LIGHT_TEX_SIZE * perpDistnace / RENDERED_LIGHT_HEIGHT;

View file

@ -18,7 +18,7 @@ struct PointLight {
struct PointLightableMesh {
struct Vector3* vertexNormals;
struct Vector3* vertexTangents;
struct Vector3* vertexCoTangents;
struct Vector3* vertexBitangents;
Vtx* inputVertices;
Vtx* oututVertices;
Gfx* drawCommand;