0

我尝试将 vertexDataTextured ArmandDeBrignac [] 数组的内容复制到 vertexDataTextured MeshVertexData[] 数组中。但它不起作用....我认为问题出在 struct 方法中,有 GLKvector 元素.....?

这是我的头文件:

struct vertexDataTextured
{
    GLKVector3      vertex;
    GLKVector3      normal;
    GLKVector2      texCoord;
};
typedef struct vertexDataTextured vertexDataTextured;
typedef vertexDataTextured* vertexDataTexturedPtr;


vertexDataTextured MeshVertexData[] = {}; 

vertexDataTextured ArmandDeBrignac[] = {
    {/*v:*/{-0.979979, -2.383373, -1.142941}, /*n:*/{0.000000, -0.725242, -0.688467}, /*t:*/{0.794971, 0.247112}},
    {/*v:*/{-0.859054, -2.367034, -0.829303}, /*n:*/{0.023591, -0.999512, 0.019593}, /*t:*/{0.786435, 0.224949}},
    {/*v:*/{-1.056731, -2.383373, -1.142941}, /*n:*/{-0.337657, -0.631642, -0.697836}, /*t:*/{0.800393, 0.247114}},
    {/*v:*/{-0.979979, -2.117816, -1.142941}, /*n:*/{0.000000, 0.500198, -0.865902}, /*t:*/{0.645127, 0.391262}},
    {/*v:*/{-0.979979, -2.383373, -1.142941}, /*n:*/{0.000000, -0.725242, -0.688467}, /*t:*/{0.663889, 0.391205}},
    {/*v:*/{-1.056731, -2.383373, -1.142941}, /*n:*/{-0.337657, -0.631642, -0.697836}, /*t:*/{0.663906, 0.396627}},
    {/*v:*/{-0.993670, -2.036772, 0.915066}, /*n:*/{-0.771722, 0.588244, 0.241585}, /*t:*/{0.293949, 0.430232}},
};


@interface FlaschenManager : NSObject

-(void) getFlaschenID: (NSString* ) Name andTexture: (NSString*) path;

@end

和我的 .m 文件

@implementation FlaschenManager

-(void) getFlaschenID: (NSString* ) Name andTexture: (NSString*) path
{

    if ([Name isEqualToString:@"ArmandDeBrignac"])
    {
        NSLog(@"%@",Name);

        MeshVertexData[0].vertex.v[0]=ArmandDeBrignac[0].vertex.v[0];
      //  MeshVertexData[] = ArmandDeBrignac[];

    } else if ([Name isEqualToString:@"Hennessy"])
    {
        NSLog(@"%@ ", Name);
        FlaschenName = Name;
    }
} 
@end
4

1 回答 1

0

也许尝试这样的事情

vertexDataTextured ArmandDeBrignac[] = {
    {/*v:*/GLKVertex3Make(-0.979979, -2.383373, -1.142941), /*n:*/GLKVertex3Make(-0.979979, -2.383373, -1.142941), /*t:*/GLKVertex2Make(-0.979979, -2.383373)
}

你也可能想去

MeshVertexData[0].vertex = ArmandDeBrignac[0].vertex;

如果您尝试访问顶点的索引 0,请改用其 xyz 组件

MeshVertexData[0].vertex.x = ArmandDeBrignac[0].vertex.x;

根本没有测试过,但这是一个建议

于 2013-04-16T14:23:37.270 回答