Compare commits
2 Commits
master
...
kimkulling
Author | SHA1 | Date |
---|---|---|
Kim Kulling | 8259362d36 | |
Kim Kulling | b4371bccac |
|
@ -290,12 +290,6 @@ void PretransformVertices::ComputeAbsoluteTransform(aiNode *pcNode) {
|
|||
}
|
||||
}
|
||||
|
||||
static void normalizeVectorArray(aiVector3D *vectorArrayIn, aiVector3D *vectorArrayOut, size_t numVectors) {
|
||||
for (size_t i=0; i<numVectors; ++i) {
|
||||
vectorArrayOut[i] = vectorArrayIn[i].Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Apply the node transformation to a mesh
|
||||
void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const {
|
||||
|
@ -322,8 +316,11 @@ void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat)
|
|||
const aiMatrix3x3 m = aiMatrix3x3(mat).Inverse().Transpose();
|
||||
|
||||
if (mesh->HasNormals()) {
|
||||
normalizeVectorArray(mesh->mNormals, mesh->mNormals, mesh->mNumVertices);
|
||||
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
|
||||
mesh->mNormals[i] = (m * mesh->mNormals[i]).Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh->HasTangentsAndBitangents()) {
|
||||
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
|
||||
mesh->mTangents[i] = (m * mesh->mTangents[i]).Normalize();
|
||||
|
|
|
@ -48,6 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
class BlendImportAreaLight : public ::testing::Test {
|
||||
public:
|
||||
BlendImportAreaLight() :
|
||||
im(nullptr) {}
|
||||
~BlendImportAreaLight() override = default;
|
||||
void SetUp() override {
|
||||
im = new Assimp::Importer();
|
||||
}
|
||||
|
|
|
@ -48,11 +48,14 @@ using namespace ::Assimp;
|
|||
|
||||
class BlenderWorkTest : public ::testing::Test {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
BlenderWorkTest() : im(nullptr) {}
|
||||
~BlenderWorkTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
im = new Assimp::Importer();
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
delete im;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue