本文整理汇总了Java中com.jme3.renderer.Camera.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.getWidth方法的具体用法?Java Camera.getWidth怎么用?Java Camera.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.renderer.Camera
的用法示例。
在下文中一共展示了Camera.getWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: renderFromControl
import com.jme3.renderer.Camera; //导入方法依赖的package包/类
/**
* Callback from Control.render(), do not use.
*
* @param rm
* @param vp
*/
private void renderFromControl(RenderManager rm, ViewPort vp) {
Camera cam = vp.getCamera();
if (meshType == ParticleMesh.Type.Point) {
float C = cam.getProjectionMatrix().m00;
C *= cam.getWidth() * 0.5f;
// send attenuation params
this.getMaterial().setFloat("Quadratic", C);
}
Matrix3f inverseRotation = Matrix3f.IDENTITY;
TempVars vars = null;
if (!worldSpace) {
vars = TempVars.get();
inverseRotation = this.getWorldRotation().toRotationMatrix(vars.tempMat3).invertLocal();
}
particleMesh.updateParticleData(particles, cam, inverseRotation);
if (!worldSpace) {
vars.release();
}
}
示例4: 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));
}
示例5: 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);
}
示例6: 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;
}
示例7: 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);
}