除了声明管道语义外,cg中的结构可以用于任何其他用途吗?
我正在使用Unity3D,此代码引发“在'Implicit / Rose'中的着色器错误:在第48行(在d3d11上)重新定义'PetalData'”。
我该如何运作?我是否缺少某些东西,或者仅仅是Unity不支持的用法?
struct PetalData {
half radius;
half2 center;
}
PetalData GetPetalData (half petalIndex, half totalPetals) {
half p = petalIndex/totalPetals;
PetalData petal;
petal.radius = 0.03 * SShape(p) + 0.01;
petal.center = sqrt(p) * AngleToDir(petalIndex);
return petal;
}
half PetalField (half2 topology, PetalData petal) {
half d = distance(topology, petal.center);
d /= petal.radius;
d = 1 - d;
d *= _Ramp;
return d;
}
如果我没看错,我相信你的结构定义需要一个终止的分号。
struct PetalData {
half radius;
half2 center;
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句