我试图通过将三个ConeMeshes合并为一个实体来创建可自定义的Qt3D组件.用户必须能够与自定义实体进行交互,因此我已将ObjectPicker添加到文件中.通常,我会使用预定义的缩放.obj文件,但我的经理希望Qt直接绘制对象.
我要组合的两个网格是在一个单独的qml文件中定义的,所以我可以在我的Scene3D中调用它.
Entity {
ObjectPicker {
id: combinedPicker
}
ConeMesh {
id: conemesh1
...
}
ConeMesh {
id: conemesh2
...
}
Transform {
id: conetransform1
}
Transform {
id: conetransform2
}
Entity {
components: [conemesh1, conetransform1, conemesh2, conetransform2, combinedPicker]
}
}
Run Code Online (Sandbox Code Playgroud)
我将网格放在一起的方法是将它们作为组件包含在单独的实体范围中,如最后一行所示.但是这种方法只渲染组件数组中的最后一个条目.在上面,那将是锥2.
以前我尝试创建多个Entity实例,并将每个id传递给ObjectPicker,
Entity {
components: [conemesh1, conetransform1, combinedPicker]
}
Entity {
components: [conemesh2, conetransform2, combinedPicker]
}
Run Code Online (Sandbox Code Playgroud)
但是根据ObjectPicker的文档,对象选择器不是由多个组件共享的.
所以我的问题是:在Qml中将多个网格合并为一个网格时,有什么相关方法?
使用带有一个参数的 Pipe 函数与根本不使用 Pipe 相比,有什么区别吗?
我目前正在实施本文中的 takeUntil 取消订阅策略。在这个SO问题的“官方解决方案”中,takeUntil运算符是通过管道发送的。但是,在此页面上使用 takeUntil 时没有使用管道。
因此,我想知道使用带有单个 Rx 运算符的 Pipe 与根本不使用 Pipe 是否有任何区别(内存泄漏/性能等)。
private destroy$ = new Subject();
...
this.potatoService.getPotato()
.pipe(
takeUntil(this.destroy$)
).subscribe(...
Run Code Online (Sandbox Code Playgroud)
相对于
this.potatoService.getPotato()
.takeUntil(this.destroy$)
.subscribe(...
Run Code Online (Sandbox Code Playgroud) 我有一个函数可以将输入字符串散列到一个带有数字的列表中,然后将它放在一个结构中。
def hash_input(input) do
hexList = :crypto.hash(:md5, input)
|> :binary.bin_to_list
%Identicon.Image{hex: hexList}
end
Run Code Online (Sandbox Code Playgroud)
我想编写一个测试来确保 hexList 中的每个元素都是一个整数,所以我想出了这个:
test "Does hashing produce a 16 space large array with numbers? " do
input = Identicon.hash_input("løsdjflksfj")
%Identicon.Image{hex: numbers} = input
assert Enum.all?(numbers, &is_integer/1) == true
Run Code Online (Sandbox Code Playgroud)
我尝试使用管道运算符(为了我自己的学习)编写测试,但我无法使用模式匹配提取管道中的十六进制属性。
test "Does hashing produce a 16 space large array with numbers? With pipe " do
assert Identicon.hash_input("løsdjflksfj")
|> %Identicon.Image{hex: numbers} = 'i want the input to the pipe operator to go here' # How do you extract the …Run Code Online (Sandbox Code Playgroud)