當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。