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


Java ViewPort类代码示例

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


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

示例1: playAudioNode

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
/**
 * Plays an instance of an audio node
 * 
 * @param key
 *            String The key associated with the audio node
 * @param volume
 *            float the volume to play the instance at (effected by global
 *            volume)
 */
public void playAudioNode(String key, float volume) {
	AudioNode audioNode = new AudioNode(getApplication().getAssetManager(), key, false);
	audioNode.setPositional(false);
	audioNode.setReverbEnabled(false);
	audioNode.setVolume(volume * getUIAudioVolume());
	getGUINode().attachChild(audioNode);
	audioNode.playInstance();
	audioNode.addControl(new AbstractControl() {

		@Override
		protected void controlRender(RenderManager rm, ViewPort vp) {
		}

		@Override
		protected void controlUpdate(float tpf) {
			if (audioNode.getStatus() != Status.Playing) {
				audioNode.removeFromParent();
			}
		}
	});
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:31,代码来源:BaseScreen.java

示例2: initFilter

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    material = new Material(manager, "Common/MatDefs/Post/CrossHatch.j3md");
    material.setColor("LineColor", lineColor);
    material.setColor("PaperColor", paperColor);

    material.setFloat("ColorInfluenceLine", colorInfluenceLine);
    material.setFloat("ColorInfluencePaper", colorInfluencePaper);

    material.setFloat("FillValue", fillValue);

    material.setFloat("Luminance1", luminance1);
    material.setFloat("Luminance2", luminance2);
    material.setFloat("Luminance3", luminance3);
    material.setFloat("Luminance4", luminance4);
    material.setFloat("Luminance5", luminance5);

    material.setFloat("LineThickness", lineThickness);
    material.setFloat("LineDistance", lineDistance);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:CrossHatchFilter.java

示例3: postQueue

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
    protected void postQueue(RenderManager renderManager, ViewPort viewPort) {
        getClipCoordinates(lightPosition, screenLightPos, viewPort.getCamera());
        //  screenLightPos.x = screenLightPos.x / viewPort.getCamera().getWidth();
        //  screenLightPos.y = screenLightPos.y / viewPort.getCamera().getHeight();

        viewPort.getCamera().getViewMatrix().mult(lightPosition, viewLightPos);
        //System.err.println("viewLightPos "+viewLightPos);
        display = screenLightPos.x < 1.6f && screenLightPos.x > -0.6f && screenLightPos.y < 1.6f && screenLightPos.y > -0.6f && viewLightPos.z < 0;
//System.err.println("camdir "+viewPort.getCamera().getDirection());
//System.err.println("lightPos "+lightPosition);
//System.err.println("screenLightPos "+screenLightPos);
        if (adaptative) {
            innerLightDensity = Math.max(lightDensity - Math.max(screenLightPos.x, screenLightPos.y), 0.0f);
        } else {
            innerLightDensity = lightDensity;
        }
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:LightScatteringFilter.java

示例4: initialize

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
		public void initialize(AppStateManager stateManager, Application app) {
			super.initialize(stateManager, app);

	        // Create a new cam for the gui
	        Camera particlesCam = new Camera(settings.getWidth(), settings.getHeight());
//	        particlesCam.setParallelProjection(true);
	        ViewPort particlesViewPort = renderManager.createPostView("Particles Default", getCamera());
//	        particlesViewPort.setClearFlags(false, false, false);
	        particlesNode = new Node("Particles Node");
//	        particlesNode.setQueueBucket(Bucket.Gui);
//	        particlesNode.setCullHint(CullHint.Never);
	        particlesViewPort.attachScene(particlesNode);



			Box b = new Box(1, 1, 1);
			Geometry geom = new Geometry("Box", b);

			Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
			mat.setColor("Color", ColorRGBA.Red);
			geom.setMaterial(mat);
			particlesNode.attachChild(geom);
		}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:25,代码来源:EffectsExample.java

示例5: renderFromControl

import com.jme3.renderer.ViewPort; //导入依赖的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();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:30,代码来源:ParticleEmitter.java

示例6: initFilter

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
protected void initFilter(@NotNull final AssetManager manager, @NotNull final RenderManager renderManager,
                          @NotNull final ViewPort viewPort, final int width, final int height) {

    final AppStateManager stateManager = SceneLoader.tryToGetStateManager();
    final LightingState state = stateManager.getState(LightingState.class);
    final DirectionalLight sunLight = state.getSunLight();

    shadowRenderer.setLight(sunLight);

    super.initFilter(manager, renderManager, viewPort, width, height);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:13,代码来源:EditableLightingStateShadowFilter.java

示例7: initFilter

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
protected void initFilter(@NotNull final AssetManager manager, @NotNull final RenderManager renderManager,
                          @NotNull final ViewPort viewPort, final int width, final int height) {

    final AppStateManager stateManager = SceneLoader.tryToGetStateManager();
    final LightingState state = stateManager.getState(LightingState.class);
    final DirectionalLight sunLight = state.getSunLight();

    setLightDirection(sunLight.getDirection());
    setLightColor(sunLight.getColor());

    super.initFilter(manager, renderManager, viewPort, width, height);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:14,代码来源:EditableWaterWithLightingStateFilter.java

示例8: controlRender

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {
	Vector3f cameraLocation = vp.getCamera().getLocation();
	
	spatial.lookAt(cameraLocation, Vector3f.UNIT_Y);
	spatial.updateGeometricState();
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:8,代码来源:CameraFacingControl.java

示例9: checkState

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
protected void checkState() {
	if (this.speed > 0 && spin == null) {
		if (hideWhenIdle)
			show();

		p.addControl(spin = new AbstractControl() {
			private float rot;

			@Override
			public Control cloneForSpatial(Spatial paramSpatial) {
				return null;
			}

			@Override
			protected void controlRender(RenderManager rm, ViewPort vp) {
			}

			@Override
			protected void controlUpdate(float tpf) {
				rot -= tpf * speed;
				if (rot < 0) {
					rot = FastMath.TWO_PI - tpf;
				}
				spatial.rotate(0, 0, tpf * speed);
				spatial.setLocalTranslation(0, 0, 0);
				spatial.rotate(0, 0, tpf * speed);
				spatial.center();
				spatial.move(getDimensions().x / 2f, getDimensions().y / 2f, 0);
			}
		});
	} else if (speed == 0 && spin != null) {
		if (hideWhenIdle)
			hide();
		p.removeControl(spin);
		spin = null;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:38,代码来源:BusySpinner.java

示例10: createRegularView

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
public JMEView createRegularView( String name, Camera camera, RenderPosition position ) {
    Node scene = new Node( name + " Node" );

    final ViewPort viewport = position.getViewportFactory( name ).apply( renderManager, camera );
    viewport.attachScene( scene );
    addLiveNode( scene );
    return new JMEView( this, viewport, camera, scene );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:PhetJMEApplication.java

示例11: initialize

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
public void initialize() {
    if (initialized) {
        throw new IllegalStateException("Scene is already initialized! sceneId=" + data.getId());
    }
    
    // 如果没有设置ViewPort则使用默认场景的ViewPort
    if (processorViewPorts == null) {
        processorViewPorts = new ViewPort[]{LuoYing.getApp().getViewPort()};
    }
    
    defaultFilterPostProcessor = new FilterPostProcessor(LuoYing.getAssetManager());
    translucentBucketFilter = new TranslucentBucketFilter();
    
    // 主要用于防止阴影、天空盒、特效粒子的BUG。查看上面说明:
    if (sceneOrigin == null) {
        sceneOrigin = new Geometry("sceneOrigin", new Box(1,1,1));
        sceneOrigin.setMaterial(MaterialUtils.createUnshaded());
        sceneOrigin.setCullHint(Spatial.CullHint.Always);
        sceneOrigin.setLocalScale(0.0001f, 0.0001f, 0.0001f);
    }
    root.attachChildAt(sceneOrigin, 0);
    
    // 载入场景
    SceneLoader sl = new SceneLoader();
    sl.addListener(this);
    ProgressData pd = data.getProgress();
    if (pd != null) {
        sl.setProgress((Progress) Loader.load(pd));
    }
    sl.load(this);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:33,代码来源:AbstractScene.java

示例12: initFilter

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
/**
 * init the given filter
 * @param filter
 * @param vp 
 */
private void initFilter(Filter filter, ViewPort vp) {
    filter.init(assetManager, renderManager, vp, width, height);
    if (filter.isRequiresDepthTexture()) {
        if (!computeDepth && renderFrameBuffer != null) {
            depthTexture = new Texture2D(width, height, Format.Depth24);
            renderFrameBuffer.setDepthTexture(depthTexture);
        }
        computeDepth = true;
        filter.getMaterial().setTexture("DepthTexture", depthTexture);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:FilterPostProcessor.java

示例13: postFrame

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
    renderManager.setCamera(viewPort.getCamera(), false);
    if (prevFilterBuffer != sceneBuffer) {
        renderManager.getRenderer().copyFrameBuffer(prevFilterBuffer, sceneBuffer, false);
    }
    renderManager.getRenderer().setFrameBuffer(sceneBuffer);
    viewPort.getQueue().renderQueue(RenderQueue.Bucket.Translucent, renderManager, viewPort.getCamera());
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:TranslucentBucketFilter.java

示例14: initFilter

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    material = new Material(manager, "Common/MatDefs/Post/Fog.j3md");
    material.setColor("FogColor", fogColor);
    material.setFloat("FogDensity", fogDensity);
    material.setFloat("FogDistance", fogDistance);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:FogFilter.java

示例15: addProcessor

import com.jme3.renderer.ViewPort; //导入依赖的package包/类
private void addProcessor() {
    // Processor frame buffer
    processor = new Processor();
    List<ViewPort> vps = app.getRenderManager().getPostViews();
    for (int i = vps.size() - 1; i >= 0; i-- ) {
        lastViewPort = vps.get(i);
        if (lastViewPort.isEnabled()) {
            break;
        }
    }
    lastViewPort.addProcessor(processor);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:13,代码来源:JfxAppState.java


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