dmsurti / AssimpKit

A library (macOS, iOS) that converts the files supported by Assimp to Scene Kit scenes.
http://assimpkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
477 stars 54 forks source link

.STL render error #96

Open jiw0220 opened 6 years ago

jiw0220 commented 6 years ago

Effect: image

Error: image

Code:

#define AssimpKitQuality1 ( \
AssimpKit_Process_CalcTangentSpace                |  \
AssimpKit_Process_GenSmoothNormals                |  \
AssimpKit_JoinIdenticalVertices            |  \
AssimpKit_Process_ImproveCacheLocality            |  \
AssimpKit_Process_LimitBoneWeights                |  \
AssimpKit_Process_RemoveRedundantMaterials      |  \
AssimpKit_Process_SplitLargeMeshes                |  \
AssimpKit_Process_Triangulate                    |  \
AssimpKit_Process_GenUVCoords                   |  \
AssimpKit_Process_SortByPType                   |  \
AssimpKit_Process_FindDegenerates               |  \
AssimpKit_Process_FindInvalidData               |  \
0 )

#define AssimpKitQuality2 ( \
AssimpKitQuality1   |  \
AssimpKit_Process_FindInstances                  |  \
AssimpKit_Process_ValidateDataStructure          |  \
AssimpKit_Process_OptimizeMeshes                 |  \
0 )

@interface MyViewController ()
@property (weak, nonatomic) IBOutlet SCNView *scnView;

@end

@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.scnView.allowsCameraControl = true;
    NSURL *url = [[NSBundle mainBundle]URLForResource:@"030" withExtension:@"stl"];
    SCNAssimpScene *assimpScene = [SCNScene assimpSceneWithURL:url postProcessFlags:AssimpKitQuality2];
    self.scnView.scene = assimpScene.modelScene;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
dmsurti commented 6 years ago

@jiw0220 Thanks for reporting and providing the .stl file.

Will be fixed when #16 is implemented.

jiw0220 commented 6 years ago

@dmsurti The STL has been sent to you by gmail