我已经将2010年sdk中的uvatlas项目从控制台应用程序转换为Windows应用程序。它正在落在追加顶点声明函数上,所以我试图创建一个函数,将顶点声明附加到顶点声明数组(由网格返回),但看起来我的代码只返回一个元素。 / p>
D3DVERTEXELEMENT9* appenddecl( D3DVERTEXELEMENT9 decl_add,
D3DVERTEXELEMENT9* source,
D3DVERTEXELEMENT9* decl_out,
UINT num_decl )
{
WORD i = 0;
UINT last_offset = 0;
BYTE last_type = 0;
UINT n_offset = 0;
for( i = 0; i < num_decl; i++ )
{
decl_out->Method = source->Method;
decl_out->Offset = source->Offset;
decl_out->Stream = source->Stream;
decl_out->Type = source->Type;
decl_out->Usage = source->Usage;
decl_out->UsageIndex = source->UsageIndex;
last_offset = decl_out->Offset;
last_type = decl_out->Type;
*decl_out++;
*source++;
}
switch(last_type)
{
case 0:
n_offset = 4;
break;
case 1:
n_offset = 8;
break;
case 2:
n_offset = 12;
break;
case 3:
n_offset = 16;
break;
case 4:
n_offset = 4;
break;
default:
break;
}
decl_out->Method = decl_add.Method;
decl_out->Offset = last_offset + n_offset;
decl_out->Stream = 0;
decl_out->Type = decl_add.Type;
decl_out->Usage = decl_add.Usage;
decl_out->UsageIndex = 1;
return decl_out;
}`
任何想法?
谢谢。 。 .`
答案 0 :(得分:0)