当前位置: 首页>>代码示例>>Java>>正文


Java Camera.setParallelProjection方法代码示例

本文整理汇总了Java中com.jme3.renderer.Camera.setParallelProjection方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.setParallelProjection方法的具体用法?Java Camera.setParallelProjection怎么用?Java Camera.setParallelProjection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.renderer.Camera的用法示例。


在下文中一共展示了Camera.setParallelProjection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateLightCamera

import com.jme3.renderer.Camera; //导入方法依赖的package包/类
/**
 * Updates the camera view direction and position based on the light
 */
public void updateLightCamera(Camera lightCam) {
    if (target.getType() == Light.Type.Directional) {
        DirectionalLight dl = (DirectionalLight) target;
        lightCam.setParallelProjection(true);
        lightCam.setLocation(Vector3f.ZERO);
        lightCam.lookAtDirection(dl.getDirection(), Vector3f.UNIT_Y);
        lightCam.setFrustum(-1, 1, -1, 1, 1, -1);
    } else {
        PointLight pl = (PointLight) target;
        lightCam.setParallelProjection(false);
        lightCam.setLocation(pl.getPosition());
        // direction will have to be calculated automatically
        lightCam.setFrustumPerspective(45, 1, 1, 300);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:ShadowCamera.java

示例2: ProjectProcessor

import com.jme3.renderer.Camera; //导入方法依赖的package包/类
public ProjectProcessor(Node root, AssetManager assetManager) {
        castCam = new Camera((int)128, (int)128);
        castCam.setParallelProjection(true);
        castCam.setFrustum(-1, 1, -1, 1, 1, -1);
        
        //Textures\tex\magic\magic.jpg
        // Textures\tex\sky\default\east.jpg
        tex = assetManager.loadTexture("Textures/tex/magic/magic.jpg");
//        tex = assetManager.loadTexture("Textures/tex/sky/default/east.jpg");
//        tex = assetManager.loadTexture("Interface/item/face/female5.jpg");
        mat = new Material(assetManager, "MatDefs/Projection/Projection.j3md");
        
        QuadXYC quad = new QuadXYC(1,1);
        projGeo = new Geometry("ProjGeo", quad);
        projGeo.setLocalScale(width, height, 1);
        Material debugMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        debugMat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
        projGeo.setMaterial(debugMat);
        projGeo.setCullHint(Spatial.CullHint.Always);
        root.attachChild(projGeo);
        
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:23,代码来源:ProjectProcessor.java

示例3: SubScreenBridge

import com.jme3.renderer.Camera; //导入方法依赖的package包/类
public SubScreenBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);
	cam.setParallelProjection(true);
	cam.setFrustumPerspective(45, 90, 0, 1);
	
	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);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:29,代码来源:SubScreenBridge.java

示例4: setData

import com.jme3.renderer.Camera; //导入方法依赖的package包/类
@Override
public void setData(EffectData data) {
    super.setData(data); 
    // TextureConstants.TEX_MAGIC default value for test.
    texture = LuoYing.getAssetManager().loadTexture(data.getAsString("texture", AssetConstants.TEXTURE_MAGIC));
    color = data.getAsColor("color");
    projPos.set(data.getAsVector3f("projPos", projPos));
    projDir.set(data.getAsVector3f("projDir", projDir)).normalizeLocal();
    projUp.set(data.getAsVector3f("projUp", projUp)).normalizeLocal();
    debug = data.getAsBoolean("debug", false);
    
    // ---- 初始化,这些是固定的,不会动态改变
    castCam = new Camera(1, 1);
    castCam.setParallelProjection(true);
    castCam.setFrustum(-1, 1, -1, 1, 1, -1);
    
    projMat = new Material(LuoYing.getAssetManager(), AssetConstants.MATERIAL_PROJECTION);
    projMat.setTexture("Texture", texture);
    // 注:初始贴图颜色,如果效果包含有ColorAnim,则这个Color设置会受影响。
    if (color != null) {
        projMat.setColor("Color", color);
    }
 
    // 创建单位Box来作为投射计算和检测,这个检查体决定了是否进行投射。当这个
    // 检测体在视角范围内以及与被投射体相交时(使用BoundingVolume检测),才进行
    // 投射渲染。以避免浪费资源。
    // 根据这个方式,有可能投射出来的效果并不在projGeo这个包含围盒内,所以尽量
    // 让这个检测体靠近或包围住想要被投射的物体的所在面,这样看起来会比较合理。
    projGeo = new Geometry("ProjGeo", new Box(0.5f, 0.5f, 0.5f));
    projGeo.setCullHint(Spatial.CullHint.Always);
    
    // 把projMat设置到当前effect中主要是为了使各种AnimColor动画能够控制这个
    // 效果的颜色,当effect存在AnimColor的时候,AnimColor会在运行时去查找被
    // 控制节点下的所有material,并动态控制这些material的颜色属性。
    
    // 注:材质必须设置到Geometry中去,如果是给节点(Node)添加设置材质,则必须
    // "先确认"节点下有子Geometry,否则setMaterial无效。
    projGeo.setMaterial(projMat);
    animNode.attachChild(projGeo);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:41,代码来源:ProjectionEffect.java

示例5: PssmShadowRenderer

import com.jme3.renderer.Camera; //导入方法依赖的package包/类
/**
 * Create a PSSM Shadow Renderer 
 * More info on the technique at http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html
 * @param manager the application asset manager
 * @param size the size of the rendered shadowmaps (512,1024,2048, etc...)
 * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). 
 */
public PssmShadowRenderer(AssetManager manager, int size, int nbSplits) {
    assetManager = manager;
    nbSplits = Math.max(Math.min(nbSplits, 4), 1);
    this.nbSplits = nbSplits;

    shadowFB = new FrameBuffer[nbSplits];
    shadowMaps = new Texture2D[nbSplits];
    dispPic = new Picture[nbSplits];
    lightViewProjectionsMatrices = new Matrix4f[nbSplits];
    splits = new ColorRGBA();
    splitsArray = new float[nbSplits + 1];

    //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
    dummyTex = new Texture2D(size, size, Format.RGBA8);

    preshadowMat = new Material(manager, "Common/MatDefs/Shadow/PreShadow.j3md");
    postshadowMat = new Material(manager, "Common/MatDefs/Shadow/PostShadowPSSM.j3md");

    for (int i = 0; i < nbSplits; i++) {
        lightViewProjectionsMatrices[i] = new Matrix4f();
        shadowFB[i] = new FrameBuffer(size, size, 1);
        shadowMaps[i] = new Texture2D(size, size, Format.Depth);

        shadowFB[i].setDepthTexture(shadowMaps[i]);

        //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
        shadowFB[i].setColorTexture(dummyTex);

        postshadowMat.setTexture("ShadowMap" + i, shadowMaps[i]);

        //quads for debuging purpose
        dispPic[i] = new Picture("Picture" + i);
        dispPic[i].setTexture(manager, shadowMaps[i], false);
    }

    setCompareMode(CompareMode.Hardware);
    setFilterMode(FilterMode.Bilinear);

    shadowCam = new Camera(size, size);
    shadowCam.setParallelProjection(true);

    for (int i = 0; i < points.length; i++) {
        points[i] = new Vector3f();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:53,代码来源:PssmShadowRenderer.java


注:本文中的com.jme3.renderer.Camera.setParallelProjection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。