我是 cocos2d/3d 的新手,我想绘制圆柱体,但为了理解功能,我试图借助此链接在 cocos3d 中加载三角形的网格节点,但我收到警告不兼容的指针类型发送“CC3MeshNode *”到“CCNode *”类型的参数和应用程序崩溃并出现以下错误。
请原谅我的英语。
2013-03-19 12:43:49.195 LipAgumentation[982:d503]-[CC3MeshNode _setZOrder:]:无法识别的选择器发送到实例 0xc44cce0
2013-03-19 12:43:49.203 LipAgumentation [982:d503] *由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[CC3MeshNode _setZOrder:]:无法识别的选择器发送到实例 0xc44cce0”
*** Call stack at first throw:
(
0 CoreFoundation 0x019335a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0161b313 objc_exception_throw + 44
2 CoreFoundation 0x019350bb -[NSObject(NSObject)
doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x018a4966 ___forwarding___ + 966
4 CoreFoundation 0x018a4522 _CF_forwarding_prep_0 + 50
5 LipAgumentation 0x0003d574 -[CCNode insertChild:z:] + 532
6 LipAgumentation 0x0003cb25 -[CCNode addChild:z:tag:] + 501
7 LipAgumentation 0x0003ce39 -[CCNode addChild:] + 313
8 LipAgumentation 0x0020754d -[LipAgumentationLayer
LoadMeshOfATriangle] + 1405
9 LipAgumentation 0x00206fbd -[LipAgumentationLayer LipsEffect] + 45
10 LipAgumentation 0x00206d3f __42-[LipAgumentationLayer
initializeControls]_block_invoke_0 + 47
11 LipAgumentation 0x00023b70 -[NSObject(CCBlocksAdditions)
ccCallbackBlockWithSender:] + 48
12 CoreFoundation 0x018a3c7d __invoking___ + 29
13 CoreFoundation 0x018a3b51 -[NSInvocation invoke] + 145
14 LipAgumentation 0x0003678f -[CCMenuItem activate] + 79
15 LipAgumentation 0x00036ff0 -[CCMenuItemLabel activate] + 160
16 LipAgumentation 0x00033e94 -[CCMenu ccTouchEnded:withEvent:] + 292
17 LipAgumentation 0x00089c3a -[CCTouchDispatcher
touches:withEvent:withTouchType:] + 1482
18 LipAgumentation 0x0008a783 -[CCTouchDispatcher
touchesEnded:withEvent:] + 115
19 LipAgumentation 0x0008c53e -[EAGLView touchesEnded:withEvent:] + 110
20 UIKit 0x009a3ded -[UIWindow _sendTouchesForEvent:] + 567
21 UIKit 0x00984c37 -[UIApplication sendEvent:] + 447
22 UIKit 0x00989f2e _UIApplicationHandleEvent + 7576
23 GraphicsServices 0x02248992 PurpleEventCallback + 1550
24 CoreFoundation 0x01914944
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
25 CoreFoundation 0x01874cf7 __CFRunLoopDoSource1 + 215
26 CoreFoundation 0x01871f83 __CFRunLoopRun + 979
27 CoreFoundation 0x01871840 CFRunLoopRunSpecific + 208
28 CoreFoundation 0x01871761 CFRunLoopRunInMode + 97
29 GraphicsServices 0x022471c4 GSEventRunModal + 217
30 GraphicsServices 0x02247289 GSEventRun + 115
31 UIKit 0x0098dc93 UIApplicationMain + 1160
32 LipAgumentation 0x00205ed6 main + 134
33 LipAgumentation 0x00002bb5 start + 53
)
终止称为抛出异常
这是我绘制三角形的代码
static float arr_location[] = {-1.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0};
static float arr_normal[] = {0.0,0.0,1.0, 0.0,0.0,1.0, 0.0,0.0,1.0};
static ushort arr_indice[] = {0,1,2};
static float arr_texture[] = {1.0,0.0, 0.0,0.0, 0.0,1.0};
CC3VertexLocations *locationDemo =
[[CC3VertexLocations vertexArrayWithName:@"demoLocation"] autorelease];
locationDemo.drawingMode = GL_TRIANGLES;
[locationDemo setVertexCount:3];
[locationDemo setVertices:arr_location];
CC3VertexNormals *demonormal =
[[CC3VertexNormals vertexArrayWithName:@"demoNormal"] autorelease];
[demonormal setVertexCount:3];
[demonormal setVertices:arr_normal];
CC3VertexIndices *demoIndices = [CC3VertexIndices vertexArrayWithName: @"demoIndicies"];
demoIndices.drawingMode = GL_TRIANGLES;
[demoIndices setVertexCount:3];
[demoIndices setVertices:arr_indice];
CC3Texture *demoTex;
demoTex = [[CC3Texture textureFromFile:@"2.jpg"] autorelease];
CC3VertexTextureCoordinates *demoTexture =
[CC3VertexTextureCoordinates vertexArrayWithName:@"demoTexture"];
[demoIndices setVertexCount:3];
[demoIndices setVertices:arr_texture];
[demoTexture alignWithTexture:demoTex];
CC3VertexArrayMesh *demoMeshModel =
[[CC3VertexArrayMesh meshWithName:@"demoMeshModel"] autorelease];
demoMeshModel.vertexLocations = locationDemo;
demoMeshModel.vertexNormals = normal;
demoMeshModel.vertexIndices = demoIndices;
demoMeshModel.vertexTextureCoordinates = demoTexture;
CC3MeshNode* demoMesh = [CC3MeshNode nodeWithName:@"demoMeshNode"];
demoMesh.mesh = demoMeshModel;
demoMesh.material = [CC3Material shiny];
demoMesh.material.name = [NSString stringWithFormat: @"demoMeshNode"];
demoMesh.material.diffuseColor = CCC4FMake(1.0, 1.0, 1.0, 1.0);
[demoMesh.material setTexture:demoTex];
[self addChild:demoMesh];