本文整理汇总了Java中com.jme3.renderer.RenderManager.getRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java RenderManager.getRenderer方法的具体用法?Java RenderManager.getRenderer怎么用?Java RenderManager.getRenderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.renderer.RenderManager
的用法示例。
在下文中一共展示了RenderManager.getRenderer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: initialize
import com.jme3.renderer.RenderManager; //导入方法依赖的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: postQueue
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
@Override
protected void postQueue(RenderManager renderManager, ViewPort viewPort) {
Renderer r = renderManager.getRenderer();
r.setFrameBuffer(normalPass.getRenderFrameBuffer());
renderManager.getRenderer().clearBuffers(true, true, true);
renderManager.setForcedTechnique("PreNormalPass");
renderManager.renderViewPortQueues(viewPort, false);
renderManager.setForcedTechnique(null);
renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
}
示例4: initialize
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp) {
this.renderManager = rm;
renderDev.setRenderManager(rm);
inited = true;
this.vp = vp;
this.renderer = rm.getRenderer();
inputSys.setHeight(vp.getCamera().getHeight());
}
示例5: preload
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
/**
* Preloads this material for the given render manager.
* <p>
* Preloading the material can ensure that when the material is first
* used for rendering, there won't be any delay since the material has
* been already been setup for rendering.
*
* @param rm The render manager to preload for
*/
public void preload(RenderManager rm) {
autoSelectTechnique(rm);
Renderer r = rm.getRenderer();
TechniqueDef techDef = technique.getDef();
Collection<MatParam> params = paramValues.values();
for (MatParam param : params) {
if (param instanceof MatParamTexture) {
MatParamTexture texParam = (MatParamTexture) param;
r.setTexture(0, texParam.getTextureValue());
} else {
if (!techDef.isUsingShaders()) {
continue;
}
technique.updateUniformParam(param.getName(),
param.getVarType(),
param.getValue(), true);
}
}
Shader shader = technique.getShader();
if (techDef.isUsingShaders()) {
r.setShader(shader);
}
}
示例6: initialize
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
/**
* Initializes the shared textures.
* The texture is created (not with the constructor taking the texture as argument),
* uploaded to the GPU and shared with OpenCL.
* Must be called from the jME main thread.
*
* @param renderManager the render manager
* @param clContext the OpenCL context
* @param memoryAccess the allowed memory access to the OpenCL texture
*
* @throws IllegalStateException if it was already initialized
* @throws IllegalArgumentException
* If the underlying renderer implementation is not {@code GLRenderer}, or
* if the OpenCL texture type can't be mapped to a texture type of jME
*/
public void initialize(RenderManager renderManager, Context clContext, MemoryAccess memoryAccess) {
if (isInitialized()) {
throw new IllegalStateException("already initialized");
}
//get renderer
if (renderManager.getRenderer() instanceof GLRenderer) {
renderer = (GLRenderer) renderManager.getRenderer();
} else {
throw new IllegalArgumentException("Only GLRenderer supported");
}
//create texture
if (texture == null) {
switch (descriptor.type) {
case IMAGE_2D:
texture = new Texture2D((int) descriptor.width, (int) descriptor.height, format);
break;
case IMAGE_2D_ARRAY:
ArrayList<Image> images = new ArrayList<>((int) descriptor.arraySize);
for (int i=0; i<descriptor.arraySize; ++i) {
images.add(new Image(format, (int) descriptor.width, (int) descriptor.height, null, ColorSpace.Linear));
}
texture = new TextureArray(images);
break;
case IMAGE_3D:
texture = new Texture3D((int) descriptor.width, (int) descriptor.height, (int) descriptor.depth, format);
break;
default:
throw new IllegalArgumentException("unsupported texture type: "+descriptor.type);
}
image = texture.getImage();
}
//upload texture to GPU
renderer.updateTexImageData(image, texture.getType(), 0, false);
//create shared image
clImage = clContext.bindImage(texture, memoryAccess).register();
}
示例7: initialize
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp){
if (!enabled)
return;
renderer = rm.getRenderer();
renderManager = rm;
viewPort = vp;
// loadInitial()
fsQuad = new Picture("HDR Fullscreen Quad");
Format lumFmt = Format.Luminance8;
scene64FB = new FrameBuffer(64, 64, 1);
scene64 = new Texture2D(64, 64, lumFmt);
scene64FB.setColorTexture(scene64);
scene64.setMagFilter(fbMagFilter);
scene64.setMinFilter(fbMinFilter);
scene8FB = new FrameBuffer(8, 8, 1);
scene8 = new Texture2D(8, 8, lumFmt);
scene8FB.setColorTexture(scene8);
scene8.setMagFilter(fbMagFilter);
scene8.setMinFilter(fbMinFilter);
scene1FB[0] = new FrameBuffer(1, 1, 1);
scene1[0] = new Texture2D(1, 1, lumFmt);
scene1FB[0].setColorTexture(scene1[0]);
scene1FB[1] = new FrameBuffer(1, 1, 1);
scene1[1] = new Texture2D(1, 1, lumFmt);
scene1FB[1].setColorTexture(scene1[1]);
// prepare tonemap shader
tone = new Material(manager, "Common/MatDefs/Hdr/ToneMap.j3md");
tone.setFloat("A", 0.18f);
tone.setFloat("White", 100);
// load();
int w = vp.getCamera().getWidth();
int h = vp.getCamera().getHeight();
reshape(vp, w, h);
}
示例8: initialize
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp) {
renderer = rm.getRenderer();
reshape(vp, vp.getCamera().getWidth(), vp.getCamera().getHeight());
}
示例9: setRenderManager
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
public void setRenderManager(RenderManager rm){
this.rm = rm;
this.r = rm.getRenderer();
}
示例10: render
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
/**
* Called by {@link RenderManager} to render the geometry by
* using this material.
*
* @param geom The geometry to render
* @param rm The render manager requesting the rendering
*/
public void render(Geometry geom, RenderManager rm) {
autoSelectTechnique(rm);
Renderer r = rm.getRenderer();
TechniqueDef techDef = technique.getDef();
if (techDef.getLightMode() == LightMode.MultiPass
&& geom.getWorldLightList().size() == 0) {
return;
}
if (rm.getForcedRenderState() != null) {
r.applyRenderState(rm.getForcedRenderState());
} else {
if (techDef.getRenderState() != null) {
r.applyRenderState(techDef.getRenderState().copyMergedTo(additionalState, mergedRenderState));
} else {
r.applyRenderState(RenderState.DEFAULT.copyMergedTo(additionalState, mergedRenderState));
}
}
// update camera and world matrices
// NOTE: setWorldTransform should have been called already
if (techDef.isUsingShaders()) {
// reset unchanged uniform flag
clearUniformsSetByCurrent(technique.getShader());
rm.updateUniformBindings(technique.getWorldBindUniforms());
}
// setup textures and uniforms
for (int i = 0; i < paramValues.size(); i++) {
MatParam param = paramValues.getValue(i);
param.apply(r, technique);
}
Shader shader = technique.getShader();
// send lighting information, if needed
switch (techDef.getLightMode()) {
case Disable:
r.setLighting(null);
break;
case SinglePass:
updateLightListUniforms(shader, geom, 4);
break;
case FixedPipeline:
r.setLighting(geom.getWorldLightList());
break;
case MultiPass:
// NOTE: Special case!
resetUniformsNotSetByCurrent(shader);
renderMultipassLighting(shader, geom, r);
// very important, notice the return statement!
return;
}
// upload and bind shader
if (techDef.isUsingShaders()) {
// any unset uniforms will be set to 0
resetUniformsNotSetByCurrent(shader);
r.setShader(shader);
}
r.renderMesh(geom.getMesh(), geom.getLodLevel(), 1);
}