isgl3d pod文件未在iPad中显示

时间:2013-04-24 17:46:34

标签: ios ipad isgl3d

我正在尝试使用ISGL3D框架导入POD文件3d对象(使用Blender导出)到我的ipad中。我没有得到任何错误,但我的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;}

我试图在没有_podImporter摄像头的情况下添加3d对象,但我发现它无法找到我的3d对象。请帮助和谢谢!

1 个答案:

答案 0 :(得分: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:)];

} 返回自我;}