Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for two-sided materials #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions AssimpKit/Code/Model/AssimpImporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -933,13 +933,17 @@ - (NSMutableArray *)makeMaterialsForNode:(const struct aiNode *)aiNode
DLog(@" Using add blend mode");
material.blendMode = SCNBlendModeAdd;
}

DLog(@"+++ Loading cull/double sided mode");
/**
FIXME: The cull mode works only on iOS. Not on OSX.
Hence has been defaulted to Cull Back.
USE AI_MATKEY_TWOSIDED to get the cull mode.
*/

// SceneKit only allows for either backside culling or frontside culling,
// but doubleSided allows for the material to be applied on both sides.
material.cullMode = SCNCullBack;

int twoSided = 0;
material.doubleSided = (aiGetMaterialIntegerArray(aiMaterial, AI_MATKEY_TWOSIDED, (int *)&twoSided, NULL) == AI_SUCCESS && twoSided != 0);


DLog(@"+++ Loading shininess");
int shininess;
aiGetMaterialIntegerArray(aiMaterial, AI_MATKEY_BLEND_FUNC,
Expand Down