本文整理匯總了Java中com.jme3.renderer.RenderManager類的典型用法代碼示例。如果您正苦於以下問題:Java RenderManager類的具體用法?Java RenderManager怎麽用?Java RenderManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RenderManager類屬於com.jme3.renderer包,在下文中一共展示了RenderManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateMaterialImpl
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
/**
* Update the {@link Material} in the {@link EditorThread}.
*
* @param material the new material.
*/
@JMEThread
protected void updateMaterialImpl(@NotNull final Material material) {
final Geometry testBox = getTestBox();
testBox.setMaterial(material);
final Geometry testQuad = getTestQuad();
testQuad.setMaterial(material);
final Geometry testSphere = getTestSphere();
testSphere.setMaterial(material);
final RenderManager renderManager = EDITOR.getRenderManager();
try {
renderManager.preloadScene(testBox);
} catch (final RendererException | AssetNotFoundException | UnsupportedOperationException e) {
handleMaterialException(e);
testBox.setMaterial(EDITOR.getDefaultMaterial());
testQuad.setMaterial(EDITOR.getDefaultMaterial());
testSphere.setMaterial(EDITOR.getDefaultMaterial());
}
}
示例2: getViewportFactory
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
public Function2<RenderManager, Camera, ViewPort> getViewportFactory( final String name ) {
return new Function2<RenderManager, Camera, ViewPort>() {
public ViewPort apply( RenderManager renderManager, Camera camera ) {
switch( RenderPosition.this ) {
case BACK:
return JMEUtils.getApplication().renderManager.createPreView( name + " (back viewport)", camera );
case MAIN:
return JMEUtils.getApplication().renderManager.createMainView( name + " (main viewport)", camera );
case FRONT:
return JMEUtils.getApplication().renderManager.createPostView( name + " (front viewport)", camera );
default:
throw new IllegalArgumentException( "unknown position: " + RenderPosition.this );
}
}
};
}
示例3: simpleRender
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
@Override
public void simpleRender(RenderManager rm){
Renderer r = rm.getRenderer();
//do FBO rendering
r.setFrameBuffer(fb);
rm.setCamera(cam, false); // FBO uses current camera
r.clearBuffers(true, true, true);
rm.renderScene(fbNode, viewPort);
rm.flushQueue(viewPort);
//go back to default rendering and let
//SimpleApplication render the default scene
r.setFrameBuffer(null);
}
示例4: renderGeometryList
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
private void renderGeometryList(GeometryList list, RenderManager rm, Camera cam, boolean clear) {
list.setCamera(cam); // select camera for sorting
list.sort();
for (int i = 0; i < list.size(); i++) {
Spatial obj = list.get(i);
assert obj != null;
if (obj instanceof Geometry) {
Geometry g = (Geometry) obj;
rm.renderGeometry(g);
// make sure to reset queue distance
}
if (obj != null) {
obj.queueDistance = Float.NEGATIVE_INFINITY;
}
}
if (clear) {
list.clear();
}
}
示例5: renderQueue
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
public void renderQueue(Bucket bucket, RenderManager rm, Camera cam, boolean clear) {
switch (bucket) {
case Gui:
renderGeometryList(guiList, rm, cam, clear);
break;
case Opaque:
renderGeometryList(opaqueList, rm, cam, clear);
break;
case Sky:
renderGeometryList(skyList, rm, cam, clear);
break;
case Transparent:
renderGeometryList(transparentList, rm, cam, clear);
break;
case Translucent:
renderGeometryList(translucentList, rm, cam, clear);
break;
default:
throw new UnsupportedOperationException("Unsupported bucket type: " + bucket);
}
}
示例6: testHardwareSupported
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
private boolean testHardwareSupported(RenderManager rm) {
for (Material m : materials) {
// Some of the animated mesh(es) do not support hardware skinning,
// so it is not supported by the model.
if (m.getMaterialDef().getMaterialParam("NumberOfBones") == null) {
Logger.getLogger(CustomSkeletonControl.class.getName()).log(Level.WARNING,
"Not using hardware skinning for {0}, " +
"because material {1} doesn''t support it.",
new Object[]{spatial, m.getMaterialDef().getName()});
return false;
}
}
switchToHardware();
try {
rm.preloadScene(spatial);
return true;
} catch (RendererException e) {
Logger.getLogger(CustomSkeletonControl.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e);
return false;
}
}
示例7: initFilter
import com.jme3.renderer.RenderManager; //導入依賴的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);
}
示例8: postQueue
import com.jme3.renderer.RenderManager; //導入依賴的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;
}
}
示例9: initCamera
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
/**
* Creates the camera to use for rendering. Default values are perspective
* projection with 45° field of view, with near and far values 1 and 1000
* units respectively.
*/
private void initCamera(){
cam = new Camera(settings.getWidth(), settings.getHeight());
cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f);
cam.setLocation(new Vector3f(0f, 0f, 10f));
cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
renderManager = new RenderManager(renderer);
//Remy - 09/14/2010 setted the timer in the renderManager
renderManager.setTimer(timer);
viewPort = renderManager.createMainView("Default", cam);
viewPort.setClearFlags(true, true, true);
// Create a new cam for the gui
Camera guiCam = new Camera(settings.getWidth(), settings.getHeight());
guiViewPort = renderManager.createPostView("Gui Default", guiCam);
guiViewPort.setClearFlags(false, false, false);
}
示例10: initialize
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
public void initialize(RenderManager rm, ViewPort vp) {
this.rm = rm;
this.vp = vp;
loadTextures(manager);
createTextures();
applyTextures(material);
createPreViews();
material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar()));
if (debug) {
dispRefraction = new Picture("dispRefraction");
dispRefraction.setTexture(manager, refractionTexture, false);
dispReflection = new Picture("dispRefraction");
dispReflection.setTexture(manager, reflectionTexture, false);
dispDepth = new Picture("depthTexture");
dispDepth.setTexture(manager, depthTexture, false);
}
}
示例11: renderFromControl
import com.jme3.renderer.RenderManager; //導入依賴的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();
}
}
示例12: render
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
@Override
public void render(RenderManager rm) {
super.render(rm);
if (!isEnabled()) {
return;
}
if (threadingType == ThreadingType.PARALLEL) {
//update the physics parallel while rendering
physicsFuture = executor.submit(parallelPhysicsUpdate);
} else if (threadingType == ThreadingType.SEQUENTIAL) {
//update the physics before rendering
bulletSystem.update(tpf);
}
}
示例13: render
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
@Override
public void render(@NotNull final RenderManager renderManager) {
if (!isEnabled()) return;
switch (threadingType) {
case PARALLEL: {
physicsFuture = executor.submit(physicsUpdateTask);
break;
}
case SEQUENTIAL: {
physicsSpace.update(tpf * speed);
break;
}
}
}
示例14: render
import com.jme3.renderer.RenderManager; //導入依賴的package包/類
@Override
public void render(final RenderManager renderManager) {
try {
if (pbrScene == null) {
return;
}
if (frame == 2 && !preparing) {
prepareToMakeProbe();
Node environmentScene = getEnvironmentScene();
if (environmentScene == null) {
environmentScene = EMPTY_SCENE;
}
environmentScene.updateGeometricState();
LightProbeFactory.updateProbe(lightProbe, this, environmentScene, getGenerationType(), probeHandler);
frame++;
} else if (frame < 2) {
frame++;
}
} finally {
super.render(renderManager);
}
}
示例15: initFilter
import com.jme3.renderer.RenderManager; //導入依賴的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);
}