我从here找到了很棒的参考,用于自定义和显示AR特征点。
它的工作原理很棒,但它显示了金字塔,我需要显示出平坦的白色点:
我需要写些什么来显示白点而不是金字塔?
更新:那是我最终所做的,并且效果很好:
if (this.timestamp != cloud.timestamp && materialHolder.getNow(null) != null) {
timestamp = cloud.timestamp
val buf = cloud.points
// Point clouds are 4 values x,y,z and a confidence value.
numOfFeaturePoints = buf.limit() / 4
// no features in the cloud
if (numOfFeaturePoints < 1) {
renderable = null
return
}
if (isInProcess) {
return
}
isInProcess = true
// remove current feature points
for (child in children) {
child.renderable = null
}
// add the new feature points as dots
val feature = Vector3()
for (i in 0 until buf.limit() / 4) {
// feature point
feature.x = buf.get(i * 4)
feature.y = buf.get(i * 4 + 1)
feature.z = buf.get(i * 4 + 2)
val node = Node()
node.renderable = ShapeFactory.makeCylinder(0.01f, 0.001f, Vector3(feature.x, feature.y, feature.z), myMaterial)
node.renderable!!.isShadowCaster = false
node.setParent(this)
}
isInProcess = false
}