【问题标题】:isgl3d pod file did not show in iPadisgl3d pod 文件未在 iPad 中显示
【发布时间】:2013-04-24 17:46:34
【问题描述】:

我正在尝试使用 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 对象。请帮忙,谢谢!

【问题讨论】:

    标签: ios ipad isgl3d


    【解决方案1】:

    我花了一段时间才发现问题:

    我错过了这段代码:

    [_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:)];
    

    } 返回自我;}

    【讨论】:

      猜你喜欢
      • 2018-01-31
      • 2012-01-28
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-20
      • 1970-01-01
      相关资源
      最近更新 更多