0
如何將相機投影到JMonkeyEngine3中作爲紋理的多維數據集? 你會介意幫助我嗎?如何在jMonkeyEngine 3中將相機投影到多維數據集上作爲紋理?
我試圖通過這段代碼做到這一點,但它dosent工作:
private void addCamera() {
Camera c = new Camera(100, 100);
c.setViewPort(0, 1, 0, 1);
c.setLocation(Vector3f.ZERO);
ViewPort v = new ViewPort("c", c);
v.attachScene(rootNode);
FrameBuffer fb = v.getOutputFrameBuffer();
fb.setDepthBuffer(Format.Depth);
Texture2D niftytex = new Texture2D(1024, 768, Format.RGB8);
fb.setColorTexture(niftytex);
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("m_ColorMap", niftytex);
/**
* Here comes the texture!
*/
geom.setMaterial(mat);
localRootNode.attachChild(geom);
}
究竟什麼不行?我可以在這裏發現一些問題:1)'fb'爲NULL。 2)你需要設置'v.setOutputFrameBuffer()'3)材質參數是'ColorMap',不含'm_'。 – 1000ml