Skip to content

Commit

Permalink
Merge branch 'hotfix/1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreffs committed Apr 30, 2020
2 parents a4bec36 + 8cd6a59 commit 0de0005
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 1 addition & 3 deletions Sources/Assimp/AiMatKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public struct AiMatKey: RawRepresentable {
public let rawValue: String

init(base: Base, texType: AiTextureType = .none, texIndex: Int = 0) {
self.rawValue = base.rawValue.withCString { basePtr -> String in
return String(format: "%@,%d,%d", basePtr, texType.rawValue, texIndex)
}
self.rawValue = "\(base.rawValue),\(texType.rawValue),\(texIndex)"
self.baseName = base.rawValue
self.texType = texType.rawValue
self.texIndex = UInt32(texIndex)
Expand Down
11 changes: 9 additions & 2 deletions Tests/AssimpTests/AssimpTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class AssimpTests: XCTestCase {
XCTAssertEqual(scene.meshes[0].numFaces, 2144)
XCTAssertEqual(scene.meshes[0].numBones, 0)
XCTAssertEqual(scene.meshes[0].numAnimMeshes, 0)

// Faces

XCTAssertEqual(scene.meshes[0].numFaces, 2144)
Expand Down Expand Up @@ -100,7 +100,11 @@ final class AssimpTests: XCTestCase {
// Cameras

XCTAssertEqual(scene.cameras.count, 1)


print(scene.materials.map { $0.debugDescription })

XCTAssertEqual(scene.materials[0].getMaterialColor(.COLOR_DIFFUSE), SIMD4<Float>(1.0, 1.0, 1.0, 1.0))
XCTAssertEqual(scene.materials[0].getMaterialString(.TEXTURE(.diffuse, 0)), "./duckCM.tga")
}

func testLoadAiSceneObj() throws {
Expand Down Expand Up @@ -237,6 +241,9 @@ final class AssimpTests: XCTestCase {
// Cameras

XCTAssertEqual(scene.cameras.count, 0)

XCTAssertEqual(scene.materials[0].getMaterialColor(.COLOR_DIFFUSE), SIMD4<Float>(0.5882353, 0.5882353, 0.5882353, 1.0))
XCTAssertEqual(scene.materials[0].getMaterialString(.TEXTURE(.diffuse, 0)), "TEST.PNG")

}
}

0 comments on commit 0de0005

Please sign in to comment.