2013-04-24 33 views
0

我正尝试使用ISGL3D框架将POD文件3d对象(从Blender使用导出)导入到我的ipad中。我没有得到任何错误,但我的iPad只显示黑屏。我尝试逐行调试,看起来像是相机问题。isgl3d pod文件未在iPad中显示

这里是我的代码在HelloWorldView:

- (id) init { 

if ((self = [super init])) { 

    container = [[self.scene createNode] retain]; 

    // Import pod data 
    _podImporter = [Isgl3dPODImporter podImporterWithFile:@"ee.pod"]; 
    Isgl3dLight * light = [Isgl3dLight lightWithHexColor:@"000000" diffuseColor:@"FFFFFF" specularColor:@"FFFFFF" attenuation:0.001]; 
    light.position = iv3(0, 0, 2); 
    light.renderLight = YES; 
    [container addChild:light]; 
///Problem seems to start from below 
    [self.camera removeFromParent]; 
    self.camera = [_podImporter cameraAtIndex:0]; 
    [self.scene addChild:self.camera]; 


    role01 = [_podImporter meshNodeWithName:@"Sphere"]; 
    [vound addChild:role01]; 

    [self schedule:@selector(tick:)]; 
} 
return self;} 

我试图用补充一点,3D对象了_podImporter相机和我得到的例外,它无法找到我的3D对象。请帮忙,谢谢!

回答

0

我花了一段时间才能找出问题:

我错过了这段代码:

[_podImporter buildSceneObjects]; 

所以正确的代码来获得podImporter工作是

- (id) init { 

if ((self = [super init])) { 

container = [[self.scene createNode] retain]; 

// Import pod data 
_podImporter = [Isgl3dPODImporter podImporterWithFile:@"ee.pod"]; 

[_podImporter buildSceneObjects];///<--- Put it here or anywhere before the camera code 

Isgl3dLight * light = [Isgl3dLight lightWithHexColor:@"000000" diffuseColor:@"FFFFFF" specularColor:@"FFFFFF" attenuation:0.001]; 
light.position = iv3(0, 0, 2); 
light.renderLight = YES; 
[container addChild:light]; 
[self.camera removeFromParent]; 
self.camera = [_podImporter cameraAtIndex:0]; 
[self.scene addChild:self.camera]; 


role01 = [_podImporter meshNodeWithName:@"Sphere"]; 
[vound addChild:role01]; 

[self schedule:@selector(tick:)]; 

} 返回自我;}