Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何正确地将GLSL*-运算符转换为HLSL?_Glsl_Hlsl - Fatal编程技术网

如何正确地将GLSL*-运算符转换为HLSL?

如何正确地将GLSL*-运算符转换为HLSL?,glsl,hlsl,Glsl,Hlsl,我正在尝试将GLSL代码移植到HLSL,但在此操作结束时出现类型不匹配错误: float2 pos = p; float a = time * 100. + y * 31.; float2 lineCenter = vec2(0.5, y); pos -= lineCenter; pos *- float2x2(cos(a), -sin(a), sin(a), cos(a)); *-运算符让我很困惑,它如何正确地转换为HLSL?该行什么都不做,可以删除 基本上,*-将左部分pos乘以负的

我正在尝试将GLSL代码移植到HLSL,但在此操作结束时出现类型不匹配错误:

float2 pos = p;
float a = time * 100. + y * 31.;
float2 lineCenter = vec2(0.5, y);   
pos -= lineCenter;
pos *- float2x2(cos(a), -sin(a), sin(a), cos(a));

*-运算符让我很困惑,它如何正确地转换为HLSL?

该行什么都不做,可以删除

基本上,*-将左部分pos乘以负的右部分float2x2cosa,-sina,sina,cosa,进行计算,但由于此行没有赋值,该操作的结果将被丢弃,永远不会使用


您可以在中进行测试,因为您可以删除第23-28行,而无需更改结果图片中的任何内容。

glsl中没有*-运算符。你在哪里找到那个密码的?我想它应该是*=。你能显示原始glsl代码吗?@rabbi76这是我正在尝试的代码,我还假设它是*=但如果我将其更改为:pos=mulpos,float2x2cosa,-新浪,新浪,cosa;整个着色器工作正常,但图像失真。哇,真是个骗人的东西。。。我想,如果你想让初学者无法理解,就把它放在你的代码中吧