本文整理汇总了Java中com.jme3.renderer.Camera.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.getHeight方法的具体用法?Java Camera.getHeight怎么用?Java Camera.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.renderer.Camera
的用法示例。
在下文中一共展示了Camera.getHeight方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CombinedViewport
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
public CombinedViewport(String name,
RenderManager renderManager,
Camera mainCam,
float fov,
float near,
float far,
Node node,
FilterPostProcessor fpp
) {
this.name = name;
this.cam = new Camera(mainCam.getWidth(),mainCam.getHeight());
this.viewPort = renderManager.createMainView(name, cam);
this.fov = fov;
this.near = near;
this.far = far;
this.aspect = (float) mainCam.getWidth() / (float) mainCam.getHeight();
this.node = node;
this.fpp = fpp;
setupView();
}
示例2: initialize
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp) {
renderManager = rm;
renderer = rm.getRenderer();
viewPort = vp;
fsQuad = new Picture("filter full screen quad");
Camera cam = vp.getCamera();
//save view port diensions
left = cam.getViewPortLeft();
right = cam.getViewPortRight();
top = cam.getViewPortTop();
bottom = cam.getViewPortBottom();
originalWidth = cam.getWidth();
originalHeight = cam.getHeight();
//first call to reshape
reshape(vp, cam.getWidth(), cam.getHeight());
}
示例3: updateFrustumPoints2
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
/**
* Updates a points arrays with the frustum corners of the provided camera.
* @param viewCam
* @param points
*/
public static void updateFrustumPoints2(Camera viewCam, Vector3f[] points) {
int w = viewCam.getWidth();
int h = viewCam.getHeight();
float n = viewCam.getFrustumNear();
float f = viewCam.getFrustumFar();
points[0].set(viewCam.getWorldCoordinates(new Vector2f(0, 0), n));
points[1].set(viewCam.getWorldCoordinates(new Vector2f(0, h), n));
points[2].set(viewCam.getWorldCoordinates(new Vector2f(w, h), n));
points[3].set(viewCam.getWorldCoordinates(new Vector2f(w, 0), n));
points[4].set(viewCam.getWorldCoordinates(new Vector2f(0, 0), f));
points[5].set(viewCam.getWorldCoordinates(new Vector2f(0, h), f));
points[6].set(viewCam.getWorldCoordinates(new Vector2f(w, h), f));
points[7].set(viewCam.getWorldCoordinates(new Vector2f(w, 0), f));
}
示例4: ImageCapturer
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
public ImageCapturer(Camera cam, RenderManager renderManager, Node camNode, Node rootNode) {
this.cam = cam;
this.renderManager = renderManager;
this.camNode = camNode;
// bbuf = BufferUtils.createByteBuffer(cam.getWidth() * cam.getHeight() * 4);
bbuf = BufferUtils.createByteBuffer(cam.getWidth() * cam.getHeight() * 4);
image = new BufferedImage(cam.getWidth(), cam.getHeight(), IMAGE_TYPE);
vp = renderManager.createPreView(cam.getName() + " recorder", cam);
vp.setBackgroundColor(ColorRGBA.Black);
vp.setClearFlags(true, true, true);
fbuf = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1);
fbuf.setDepthBuffer(Format.Depth);
fbuf.setColorBuffer(Format.RGBA8);
vp.setOutputFrameBuffer(fbuf);
vp.attachScene(rootNode);
}
示例5: isVisibleOnScreen
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
/**
* Check visibility the position on the screen.
*
* @param position the position for checking.
* @param camera the camera of the screen.
* @return true of we can see the position on the screen.
*/
@FromAnyThread
public static boolean isVisibleOnScreen(@NotNull final Vector3f position, @NotNull final Camera camera) {
final int maxHeight = camera.getHeight();
final int maxWidth = camera.getWidth();
final boolean isBottom = position.getY() < 0;
final boolean isTop = position.getY() > maxHeight;
final boolean isLeft = position.getX() < 0;
final boolean isRight = position.getX() > maxWidth;
return !isBottom && !isLeft && !isTop && !isRight && position.getZ() < 1F;
}
示例6: getCameraConstant
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
/**
* This computes the "C" value in the geomipmapping paper.
* See section "2.3.1.2 Pre-calculating d"
*
* @param cam
* @param pixelLimit
* @return
*/
private float getCameraConstant(Camera cam, float pixelLimit){
float n = cam.getFrustumNear();
float t = FastMath.abs(cam.getFrustumTop());
float A = n / t;
float v_res = cam.getHeight();
float T = (2f * pixelLimit) / v_res;
return A / T;
}
示例7: displayMap
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
protected void displayMap(Renderer r, Picture pic, int left) {
Camera cam = vp.getCamera();
rm.setCamera(cam, true);
int h = cam.getHeight();
pic.setPosition(left, h / 20f);
pic.setWidth(128);
pic.setHeight(128);
pic.updateGeometricState();
rm.renderGeometry(pic);
rm.setCamera(cam, false);
}
示例8: displayShadowMap
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
private void displayShadowMap(Renderer r) {
Camera cam = viewPort.getCamera();
renderManager.setCamera(cam, true);
int h = cam.getHeight();
for (int i = 0; i < dispPic.length; i++) {
dispPic[i].setPosition(64 * (i + 1) + 128 * i, h / 20f);
dispPic[i].setWidth(128);
dispPic[i].setHeight(128);
dispPic[i].updateGeometricState();
renderManager.renderGeometry(dispPic[i]);
}
renderManager.setCamera(cam, false);
}
示例9: OSRBridge
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
public OSRBridge(RenderManager rm, int width, int height, Node root) {
this.rm = rm;
this.root = root;
cam = new Camera(width, height);
vp = rm.createPreView("Offscreen View", cam);
if (!ToolKit.isAndroid())
vp.setClearFlags(true, true, true);
else
vp.setClearFlags(true, false, false);
FrameBuffer offBuffer = new FrameBuffer(width, height, 1);
tex = new Texture2D(width, height, Image.Format.RGBA8);
tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
tex.setMagFilter(Texture.MagFilter.Bilinear);
if (!ToolKit.isAndroid())
offBuffer.setDepthBuffer(Image.Format.Depth);
offBuffer.setColorTexture(tex);
vp.setOutputFrameBuffer(offBuffer);
setSpatial(root);
vp.attachScene(root);
chaseCam = new ChaseCamera(cam, root) {
@Override
public void setDragToRotate(boolean dragToRotate) {
this.dragToRotate = dragToRotate;
this.canRotate = !dragToRotate;
}
};
chaseCam.setDefaultDistance(5f);
chaseCam.setMaxDistance(340f);
chaseCam.setDefaultHorizontalRotation(90 * FastMath.DEG_TO_RAD);
chaseCam.setDefaultVerticalRotation(0f);
cam.setFrustumFar(36000f);
float aspect = (float) cam.getWidth() / (float) cam.getHeight();
cam.setFrustumPerspective(45f, aspect, 0.1f, cam.getFrustumFar());
chaseCam.setUpVector(Vector3f.UNIT_Y);
}