0

私は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];
4

1 に答える 1

0

http://brenwill.com/docs/cocos3d/0.6.2/api/interface_c_c3_node.htmlのドキュメントを読みましたが、使用するにはCC3Node基本クラスを使用する必要がありますCC3MeshNode

CCNode「自己」は型であり、CC3Node期待どおりの基本クラスではないと確信しています。

于 2013-03-19T08:28:55.917 に答える