Cocos3D:没有将MeshNode添加到场景中

时间:2014-10-20 06:45:38

标签: ios objective-c cocos2d-iphone cocos3d

我正在尝试将2个不同pod文件中的网格节点添加到我的场景中。第一个节点('austenNode')正在添加,但不是其他三个(backpack_front,backpack_back和backpack_closed),我正在尝试从第二个pod文件添加。我在这里做错了吗?

-(void) initializeScene {

self.backdrop = [CC3Backdrop nodeWithColor:ccc4f(0.0/255.0, 0.0/255.0, 0.0/255.0, 0.0)];

CC3Camera* cam = [CC3Camera nodeWithName: @"Camera"];
cam.location = cc3v( 32.0, 10.6 , -10.0 );
[cam rotateByAngle:126 aroundAxis:cc3v(0, 1, 0)];
cam.uniformScale=0.9;

NSLog(@"info : %f %f",[cam fieldOfView],cam.uniformScale);
[self addChild: cam];

CC3Light* lamp = [CC3Light nodeWithName: @"Lamp"];
lamp.location = cc3v( 0.0, 0.0, 0.0 );
lamp.isDirectionalOnly = NO;
[cam addChild: lamp];

self.rezNode= [CC3PODResourceNode nodeFromFile: @"Austen_Intro.pod"];
self.austenNode=[self.rezNode getNodeNamed:@"Austen_Intro.pod-SoftBody"];

[self addChild:self.austenNode];
self.austenNode.location=cc3v( 0.0, 0.0, 0.0 );
[self.austenNode rotateByAngle:60.0 aroundAxis:cc3v(0, 1, 0)];
[self.austenNode rotateByAngle:0.0 aroundAxis:cc3v(1, 0, 0)];
[self.austenNode rotateByAngle:5.0 aroundAxis:cc3v(0, 0, 1)];
[self.austenNode removeShaders];

[self addChild:self.austenNode];

self.austenNode.visible=YES;
self.austenNode.touchEnabled=YES;
self.austenNode.opacity = GLfloatFromCCOpacity(1.0);

CC3ResourceNode* rezNode2=[CC3PODResourceNode nodeFromFile: @"Austen_Success_Jump.pod"];

self.backpack_back = [CC3MeshNode nodeWithName:@"backpack_back"];
self.backpack_front = [CC3MeshNode nodeWithName:@"backpack_front"];
self.backpack_closed = [CC3MeshNode nodeWithName:@"backpack_closed"];

[self.backpack_back populateFrom:[rezNode2 getMeshNodeNamed:@"backpack_back"]];
[self.backpack_front populateFrom:[rezNode2 getMeshNodeNamed:@"backpack_back"]];
[self.backpack_closed populateFrom:[rezNode2 getMeshNodeNamed:@"backpack_back"]];


[self addChild:self.backpack_back];
[self addChild:self.backpack_front];
[self addChild:self.backpack_closed];

[self removeShaders];

self.backpack_back.location= cc3v( 2.0, 5.0, 1.0 );
self.backpack_front.location= cc3v( 2.0, 5.0, 0.0 );
self.backpack_closed.location= cc3v( 2.0, 5.0, -1.0 );

self.backpack_back.visible=YES;
self.backpack_back.touchEnabled=YES;
self.backpack_back.opacity = GLfloatFromCCOpacity(1.0);

self.backpack_front.visible=YES;
self.backpack_front.touchEnabled=YES;
self.backpack_front.opacity = GLfloatFromCCOpacity(1.0);

self.backpack_closed.visible=YES;
self.backpack_closed.touchEnabled=YES;
self.backpack_closed.opacity = GLfloatFromCCOpacity(1.0);




[self createBoundingVolumes];
[self createGLBuffers];
[self releaseRedundantContent];

LogInfo(@"The structure of this scene is: %@", [self structureDescription]);

}

0 个答案:

没有答案