【问题标题】:Call extension method in Cocos3DCocos3D 中的调用扩展方法
【发布时间】:2014-02-11 01:54:23
【问题描述】:

我是 Objective C 的新手,我正在尝试使用 Cocos3d 创建一些 3d 模型,我找到了这个文档:

/**
 * This CC3Mesh extension adds a number of methods for populating the mesh of
 * a mesh programatically to create various parametric shapes and surfaces.
 *
 * To use the methods in this extension, instantiate a CC3Mesh, and then invoke one of
 * the methods in this extension  to populate the mesh vertices.
 */
@interface CC3Mesh (ParametricShapes)

这是我要调用的方法:

-(void) populateAsTriangle: (CC3Face) face
             withTexCoords: (ccTex2F*) texCoords
           andTessellation: (GLuint) divsPerSide;

现在我有了这个:

    NSString *meshName = [NSString stringWithFormat:@"%@", 
                               [vertex objectForKey:@"meshName"]];
    CC3Mesh *mesh = [[CC3Mesh alloc] initWithName:meshName];

现在,如何从我的 *mesh 对象中调用方法 populateAsTriangle?

谢谢。

【问题讨论】:

  • 在该对象上调用任何其他方法的方式相同...
  • 当我尝试这样做时:[mesh populateAsTriangle: cc3face withTexCoords: texCoords and Tessellation: 1];我收到警告:-populateAsTriangle:withTexCoords:andTessellation:' not found (return type defaults to 'id')
  • 它可能是您不应该使用的私有方法,当方法未在标头中声明(在@interface内)时就是这种情况

标签: objective-c cocos3d


【解决方案1】:

确保导入您引用的 CC3Mesh 扩展名所在的文件:

#import "CC3ParametricMeshes.h"

【讨论】:

  • 谢谢比尔,这完全是一个新手问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-04
  • 1970-01-01
  • 1970-01-01
  • 2020-06-29
  • 1970-01-01
相关资源
最近更新 更多