ios - SCNParticle系统崩溃
问题描述
我将库存烟雾 SCNParticleSystem 添加到 ARSCNView 中场景中的节点。这按预期工作。
我用来ARSCNView.snapshot()
在绘制方法之前捕获图像和处理MTKView
draw()
。
然后,我使用粒子系统调用removeAllParticleSystems()
节点上的主线程,并使用removeFromParent()
.
然后我将其他节点添加到场景中,最终,应用程序因错误而崩溃validateFunctionArguments:3469: failed assertion 'Vertex Function(uberparticle_vert): missing buffer binding at index 19 for vertexBuffer.1[0].'
All Exceptions
断点通常在调用ARSCNView.snapshot()
时停止。
为什么这会崩溃?
错误是什么意思?
我应该如何在 ARSCNView 的场景中添加和删除粒子系统?
更新:我将我从这里使用的 MTKView 子类连接到带有粒子系统的工作 ARKit演示,并且发生了相同的顶点函数崩溃。
这是否意味着问题出在直通顶点着色器功能上?
为什么粒子系统的处理方式不同?
下面是着色器函数。谢谢。
#include <metal_stdlib>
using namespace metal;
// Vertex input/output structure for passing results from vertex shader to fragment shader
struct VertexIO
{
float4 position [[position]];
float2 textureCoord [[user(texturecoord)]];
};
// Vertex shader for a textured quad
vertex VertexIO vertexPassThrough(device packed_float4 *pPosition [[ buffer(0) ]],
device packed_float2 *pTexCoords [[ buffer(1) ]],
uint vid [[ vertex_id ]])
{
VertexIO outVertex;
outVertex.position = pPosition[vid];
outVertex.textureCoord = pTexCoords[vid];
return outVertex;
}
// Fragment shader for a textured quad
fragment half4 fragmentPassThrough(VertexIO inputFragment [[ stage_in ]],
texture2d<half> inputTexture [[ texture(0) ]],
sampler samplr [[ sampler(0) ]])
{
return inputTexture.sample(samplr, inputFragment.textureCoord);
}
解决方案
推荐阅读
- android - Flutter 使用 FlutterPlatformView 抛出异常
- android - 使用 Android,您可以将数据传输到任何站点的表单并触发发送按钮
- javascript - 带有 TimeLine 的 Javascript 动画不会在 html 中播放
- java - 为什么我在 AsyncTask 上得到 RuntimeException?
- postgresql - 如何使用 docker-compose 将卷从 Jenkins 工作区映射到 Docker 容器
- javascript - react-router:匹配和路由。在 v4 中替换 .match()
- javascript - PHP - 提交按钮并在不刷新的情况下获取值
- tsql - 选择 SQL 以选择同一日期的下一个不匹配记录
- php - 如何为社交网站中的新帖子创建 post_id
- mysql - MySQL 2 列不在(一项数组)