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