我正在努力以编程方式创建网格对象。这是完美的工作:
CC3MeshNode *pMeshBox = [[CC3MeshNode alloc] init];
[pMeshBox populateAsCenteredRectangleWithSize:CGSizeMake(3, 3) andTessellation:ccg(5, 0)]; // AsSphereWithRadius:1 andTessellation:ccg(5, 0)]; // edges, rounded-corners
[self addChild:pMeshBox];
[pMeshBox release];
但这并没有显示任何东西(我期望一个高度为 0 的平面正方形,并在 x/z 方向上产生)。
float fPolygonVertices[] = {
-3, 0, 3,
3, 0, 3,
3, 0, -3,
-3, 0, -3
};
CC3VertexLocations* pvlPolygon = [CC3VertexLocations vertexArrayWithName: @"PolygonVL"];
pvlPolygon.vertexCount = 4;
pvlPolygon.vertices = fPolygonVertices;
CC3VertexArrayMesh* pvamPolygon = [CC3VertexArrayMesh meshWithName:@"PolygonM"];
pvamPolygon.vertexLocations = pvlPolygon;
CC3MeshNode *pMeshNode = [[CC3MeshNode alloc] init];
pMeshNode.mesh = pvamPolygon;
ccColor3B color = { 50, 0, 200 };
pMeshNode.color = color;
[self addChild:pMeshNode];
[pMeshNode release];
我假设相机设置和其他一切都是正确的,因为场景显示 populateAsCenteredRectangleWithSize 创建的对象......
我尝试了各种颜色和材质设置,但没有运气。