无法使用ISGL3D加载3d模型

时间:2013-05-10 06:24:28

标签: ios objective-c 3d isgl3d

我正在尝试使用ISGL3D将3D人体模型添加到我的应用程序中。我试过但不知何故纹理在网格上没有正确添加。这是我的代码和3d模型文件。有人可以帮帮我吗?

这是三维模型和纹理 https://www.dropbox.com/s/7xcr3ytovifwblk/3D%20Objects.zip

这是我的代码

_cameraController = [[Isgl3dDemoCameraController alloc] initWithCamera:self.camera andView:self];
    _cameraController.orbit = 300;
    _cameraController.theta = 30;
    _cameraController.phi = 30;
    _cameraController.doubleTapEnabled = NO;

    // Enable shadow rendering
    [Isgl3dDirector sharedInstance].shadowRenderingMethod = Isgl3dShadowPlanar;
    [Isgl3dDirector sharedInstance].shadowAlpha = 1;

    Isgl3dPODImporter * podImporter = [Isgl3dPODImporter podImporterWithFile:@"Male_Model.pod"];


    [podImporter buildSceneObjects];
Isgl3dShadowCastingLight * light  = [Isgl3dShadowCastingLight lightWithHexColor:@"FFFFFF" diffuseColor:@"FFFFFF" specularColor:@"FFFFFF" attenuation:0.00];
    light.position = iv3(300, 600, 300);
    [self.scene addChild:light];
Isgl3dTextureMaterial *textureMaterial2 = [[[Isgl3dTextureMaterial alloc] initWithTextureFile:@"25-OrmondAfter.jpg"
                                                                                        shininess:0.0
                                                                                        precision:Isgl3dTexturePrecisionHigh
                                                                                          repeatX:YES
                                                                                          repeatY:YES] autorelease];
    mesh = [podImporter meshAtIndex:0];
    node = (Isgl3dMeshNode*)[self.scene createNode];
    node = [node createNodeWithMesh: mesh andMaterial:textureMaterial2];
    node.position = iv3(0, -130, 0);;
    node.rotationY = 180;
    node.doubleSided = YES;
    [self.scene addChild:node];

    Isgl3dTextureMaterial *textureMaterial3 = [[[Isgl3dTextureMaterial alloc] initWithTextureFile:@"AM_Head_1k.bmp"
                                                                                        shininess:0.0
                                                                                        precision:Isgl3dTexturePrecisionHigh
                                                                                          repeatX:YES
                                                                                          repeatY:YES] autorelease];
    mesh = [podImporter meshAtIndex:1];
    node = (Isgl3dMeshNode*)[self.scene createNode];
    node = [node createNodeWithMesh: mesh andMaterial:textureMaterial3];
    node.position = iv3(0, -130, 0);;
    node.rotationY = 180;
    node.doubleSided = YES;
    [self.scene addChild:node];

    Isgl3dTextureMaterial *textureMaterial4 = [[[Isgl3dTextureMaterial alloc] initWithTextureFile:@"spin_prod_695288001.jpg"
                                                                                        shininess:0.0
                                                                                        precision:Isgl3dTexturePrecisionHigh
                                                                                          repeatX:YES
                                                                                          repeatY:YES] autorelease];
    mesh = [podImporter meshAtIndex:2];
    node = (Isgl3dMeshNode*)[self.scene createNode];
    node = [node createNodeWithMesh: mesh andMaterial:textureMaterial4];
    node.position = iv3(0, -130, 0);;
    node.rotationY = 180;
    node.doubleSided = YES;
    [self.scene addChild:node];

    Isgl3dTextureMaterial *textureMaterial5 = [[[Isgl3dTextureMaterial alloc] initWithTextureFile:@"Joe-Fresh-Studded-Boots3.jpg"
                                                                                        shininess:0.0
                                                                                        precision:Isgl3dTexturePrecisionHigh
                                                                                          repeatX:YES
                                                                                          repeatY:YES] autorelease];
    mesh = [podImporter meshAtIndex:3];
    node = (Isgl3dMeshNode*)[self.scene createNode];
    node = [node createNodeWithMesh: mesh andMaterial:textureMaterial5];
    node.position = iv3(0, -130, 0);;
    node.rotationY = 180;
    node.doubleSided = YES;
    [self.scene addChild:node];

    Isgl3dTextureMaterial *textureMaterial6 = [[[Isgl3dTextureMaterial alloc] initWithTextureFile:@"hand-texture.jpg"
                                                                                        shininess:0.0
                                                                                        precision:Isgl3dTexturePrecisionHigh
                                                                                          repeatX:YES
                                                                                          repeatY:YES] autorelease];
    mesh = [podImporter meshAtIndex:4];
    node = (Isgl3dMeshNode*)[self.scene createNode];
    node = [node createNodeWithMesh: mesh andMaterial:textureMaterial6];
    node.position = iv3(0, -130, 0);;
    node.rotationY = 180;
    node.doubleSided = YES;
    [self.scene addChild:node];

    Isgl3dTextureMaterial *textureMaterial7 = [[[Isgl3dTextureMaterial alloc] initWithTextureFile:@"hand-texture.jpg"
                                                                                        shininess:0.0
                                                                                        precision:Isgl3dTexturePrecisionHigh
                                                                                          repeatX:YES
                                                                                          repeatY:YES] autorelease];
    mesh = [podImporter meshAtIndex:5];
    node = (Isgl3dMeshNode*)[self.scene createNode];
    node = [node createNodeWithMesh: mesh andMaterial:textureMaterial7];
    node.position = iv3(0, -130, 0);;
    node.rotationY = 180;
    node.doubleSided = YES;
    [self.scene addChild:node];
[self schedule:@selector(tick:)];

请帮帮我。我真的被卡住了。

最好的问候

1 个答案:

答案 0 :(得分:0)

我使用PVRShaman检查了你的模型,当你从3D应用程序导出时,你的正常设置似乎是翻转。

阅读this并浏览设置。最有可能是3D设置问题。