比方说,我从ArFragment的命中结果中获得了三个锚点。
锚定锚= hitResult.createAnchor();
如何使用Sceneform绘制三角形并应用自定义纹理?
答案 0 :(得分:1)
第一步是创建import time
from tkinter import *
#This is where "Svar" or in English "answer" is being defined.
def Kalk(event):
if operator.get() == "+":
Svar = int(Nummer_1.get()) + int(Nummer_2.get())
display_text.set(str(Svar)) # Update textvariable
elif operator.get() == "-":
Svar = int(Nummer_1.get()) - int(Nummer_2.get())
display_text.set(str(Svar)) # Update textvariable
elif operator.get() == "*":
Svar = int(Nummer_1.get()) * int(Nummer_2.get())
display_text.set(str(Svar)) # Update textvariable
elif operator.get() == "/":
Svar = int(Nummer_1.get()) / int(Nummer_2.get())
display_text.set(str(Svar)) # Update textvariable
else:
Svar = ("Vennligst velg et av alternativene overfor")
display_text.set(Svar) # Update textvariable
kalkis = Tk()
kalkis.geometry("300x250")
kalkis.title("Kalkulator")
topFrame = Frame(kalkis)
topFrame.grid(row=0)
label = Label(topFrame, text="Du kan velge mellom '+', '-', '*'. '/' ")
label.grid(row=0)
operator = Entry(topFrame)
operator.grid(row=1)
label_2 = Label(topFrame, text="Skriv inn hvilket tall du vil bruke ")
label_2.grid(row=2)
Nummer_1 = Entry(topFrame)
Nummer_1.grid(row=3)
Label_3 = Label(topFrame, text="Skriv inn ditt andre tall ")
Label_3.grid(row=4)
Nummer_2 = Entry(topFrame)
Nummer_2.grid(row=5)
# This is where it displays "Svar" which is "answer".
display_text = StringVar() # Create a StringVar() to hold the result
label_4 = Label(topFrame, textvariable=display_text) # Associate to label
label_4.grid(row=6)
Refresh = Button(topFrame, text="Enter", command=kalkis)
Refresh.bind("<Enter>", Kalk)
Refresh.grid(row=6, column=1, sticky=W)
kalkis.mainloop()
列表,以获取asymboliclink -> /somewhere/else
regularFolder
.htaccess
safe.php
的坐标。我们将所有这些添加到列表中:
AnchorNode
然后在Anchor
中,如果我们到达三个锚点(或三个坐标),则可以创建三角形。我们将三角形生成为private final List<AnchorNode> anchorsList = new ArrayList<>();
:
OnTapArPlaneListener
这是方法ModelRenderable
的详细信息:
final Anchor anchor = hitResult.createAnchor();
final AnchorNode anchorNode = new AnchorNode(anchor);
anchorNode.setParent(arFragment.getArSceneView().getScene());
anchorsList.add(anchorNode);
if (anchorsList.size() == 3) {
final Texture.Sampler sampler = Texture.Sampler.builder()
.setMinFilter(Texture.Sampler.MinFilter.LINEAR_MIPMAP_LINEAR)
.setMagFilter(Texture.Sampler.MagFilter.LINEAR)
.setWrapModeR(Texture.Sampler.WrapMode.REPEAT)
.setWrapModeS(Texture.Sampler.WrapMode.REPEAT)
.setWrapModeT(Texture.Sampler.WrapMode.REPEAT)
.build();
Texture.builder()
.setSource(() -> getAssets().open("wall.jpg"))
.setSampler(sampler)
.build()
.thenAccept(texture -> MaterialFactory.makeOpaqueWithTexture(this, texture)
.thenAccept(material -> {
final Node node = new Node();
final ModelRenderable triangle = makeTriangleWithAnchors(anchorsList, material);
node.setParent(arFragment.getArSceneView().getScene());
node.setRenderable(triangle);
})
);
}