本文整理汇总了Java中com.jme3.renderer.RendererException类的典型用法代码示例。如果您正苦于以下问题:Java RendererException类的具体用法?Java RendererException怎么用?Java RendererException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RendererException类属于com.jme3.renderer包,在下文中一共展示了RendererException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateMaterialImpl
import com.jme3.renderer.RendererException; //导入依赖的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());
}
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:28,代码来源:BaseMaterialEditor3DState.java
示例2: update
import com.jme3.renderer.RendererException; //导入依赖的package包/类
@Override
@JMEThread
public void update() {
final long stamp = syncLock();
try {
final JMEThreadExecutor executor = JMEThreadExecutor.getInstance();
executor.execute();
//System.out.println(cam.getRotation());
//System.out.println(cam.getLocation());
super.update();
} catch (final AssetNotFoundException | RendererException | AssertionError | ArrayIndexOutOfBoundsException |
NullPointerException | StackOverflowError | IllegalStateException | UnsupportedOperationException e) {
LOGGER.warning(e);
finishWorkOnError(e);
} finally {
syncUnlock(stamp);
}
listener.setLocation(cam.getLocation());
listener.setRotation(cam.getRotation());
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:Editor.java
示例3: testHardwareSupported
import com.jme3.renderer.RendererException; //导入依赖的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;
}
}
开发者ID:huliqing,项目名称:LuoYing,代码行数:25,代码来源:CustomSkeletonControl.java
示例4: testHardwareSupported
import com.jme3.renderer.RendererException; //导入依赖的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(SkeletonControl_31.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(SkeletonControl_31.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e);
return false;
}
}
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:25,代码来源:SkeletonControl_31.java
示例5: testHardwareSupported
import com.jme3.renderer.RendererException; //导入依赖的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(SkeletonControl.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(SkeletonControl.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e);
return false;
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:25,代码来源:SkeletonControl.java
示例6: tryToLoad
import com.jme3.renderer.RendererException; //导入依赖的package包/类
/**
* Try to load and show the model.
*
* @param model the model.
*/
@JMEThread
private void tryToLoad(@NotNull final Spatial model) {
try {
final Editor editor = Editor.getInstance();
final RenderManager renderManager = editor.getRenderManager();
renderManager.preloadScene(model);
modelNode.attachChild(model);
} catch (final RendererException | AssetNotFoundException | UnsupportedOperationException e) {
EditorUtil.handleException(LOGGER, this, e);
}
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:20,代码来源:JMEFilePreviewManager.java
示例7: openModelImpl
import com.jme3.renderer.RendererException; //导入依赖的package包/类
/**
* The process of showing the model in the scene.
*/
@JMEThread
private void openModelImpl(@NotNull final M model) {
final Node modelNode = getModelNode();
final M currentModel = getCurrentModel();
if (currentModel != null) {
detachPrevModel(modelNode, currentModel);
}
NodeUtils.visitGeometry(model, geometry -> {
final RenderManager renderManager = EDITOR.getRenderManager();
try {
renderManager.preloadScene(geometry);
} catch (final RendererException | AssetNotFoundException | UnsupportedOperationException e) {
EditorUtil.handleException(LOGGER, this,
new RuntimeException("Found invalid material in the geometry: [" + geometry.getName() + "]. " +
"The material will be removed from the geometry.", e));
geometry.setMaterial(EDITOR.getDefaultMaterial());
}
});
attachModel(model, modelNode);
setCurrentModel(model);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:32,代码来源:AbstractSceneEditor3DState.java
示例8: updateRenderBuffer
import com.jme3.renderer.RendererException; //导入依赖的package包/类
private void updateRenderBuffer(FrameBuffer fb, RenderBuffer rb) {
int id = rb.getId();
if (id == -1) {
glGenRenderbuffersEXT(intBuf1);
id = intBuf1.get(0);
rb.setId(id);
}
if (context.boundRB != id) {
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, id);
context.boundRB = id;
}
if (fb.getWidth() > maxRBSize || fb.getHeight() > maxRBSize) {
throw new RendererException("Resolution " + fb.getWidth()
+ ":" + fb.getHeight() + " is not supported.");
}
TextureUtil.checkFormatSupported(rb.getFormat());
if (fb.getSamples() > 1 && GLContext.getCapabilities().GL_EXT_framebuffer_multisample) {
int samples = fb.getSamples();
if (maxFBOSamples < samples) {
samples = maxFBOSamples;
}
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,
samples,
TextureUtil.convertTextureFormat(rb.getFormat()),
fb.getWidth(),
fb.getHeight());
} else {
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
TextureUtil.convertTextureFormat(rb.getFormat()),
fb.getWidth(),
fb.getHeight());
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:38,代码来源:LwjglRenderer.java
示例9: copyFrameBuffer
import com.jme3.renderer.RendererException; //导入依赖的package包/类
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth) {
if (GLContext.getCapabilities().GL_EXT_framebuffer_blit) {
int srcW = 0;
int srcH = 0;
int dstW = 0;
int dstH = 0;
int prevFBO = context.boundFBO;
if (src != null && src.isUpdateNeeded()) {
updateFrameBuffer(src);
}
if (dst != null && dst.isUpdateNeeded()) {
updateFrameBuffer(dst);
}
if (src == null) {
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
// srcW = viewWidth;
// srcH = viewHeight;
} else {
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, src.getId());
srcW = src.getWidth();
srcH = src.getHeight();
}
if (dst == null) {
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
// dstW = viewWidth;
// dstH = viewHeight;
} else {
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, dst.getId());
dstW = dst.getWidth();
dstH = dst.getHeight();
}
int mask = GL_COLOR_BUFFER_BIT;
if (copyDepth) {
mask |= GL_DEPTH_BUFFER_BIT;
}
glBlitFramebufferEXT(0, 0, srcW, srcH,
0, 0, dstW, dstH, mask,
GL_NEAREST);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prevFBO);
try {
checkFrameBufferError();
} catch (IllegalStateException ex) {
logger.log(Level.SEVERE, "Source FBO:\n{0}", src);
logger.log(Level.SEVERE, "Dest FBO:\n{0}", dst);
throw ex;
}
} else {
throw new RendererException("EXT_framebuffer_blit required.");
// TODO: support non-blit copies?
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:57,代码来源:LwjglRenderer.java
示例10: checkFormatSupported
import com.jme3.renderer.RendererException; //导入依赖的package包/类
public static void checkFormatSupported(Format fmt) {
if (!isFormatSupported(fmt, GLContext.getCapabilities())) {
throw new RendererException("Image format '" + fmt + "' is unsupported by the video hardware.");
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:6,代码来源:TextureUtil.java
示例11: reloadMaterial
import com.jme3.renderer.RendererException; //导入依赖的package包/类
public Material reloadMaterial(Material mat) {
Material dummy;
try {
((ProjectAssetManager) mat.getMaterialDef().getAssetManager()).clearCache();
//creating a dummy mat with the mat def of the mat to reload
dummy = new Material(mat.getMaterialDef());
for (MatParam matParam : mat.getParams()) {
dummy.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue());
}
if (mat.getActiveTechnique() != null) {
dummy.selectTechnique(mat.getActiveTechnique().getDef().getName(), SceneApplication.getApplication().getRenderManager());
}
dummy.getAdditionalRenderState().set(mat.getAdditionalRenderState());
//creating a dummy geom and assigning the dummy material to it
Geometry dummyGeom = new Geometry("dummyGeom", new Box(1f, 1f, 1f));
dummyGeom.setMaterial(dummy);
//preloading the dummyGeom, this call will compile the shader again
SceneApplication.getApplication().getRenderManager().preloadScene(dummyGeom);
} catch (RendererException e) {
//compilation error, the shader code will be output to the console
//the following code will output the error
//System.err.println(e.getMessage());
//Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.SEVERE, e.getMessage());
smartLog("{0}", e.getMessage());
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
label.setIcon(Icons.error);
}
});
return null;
} catch (NullPointerException npe) {
//utterly bad, but for some reason I get random NPE here and can't figure out why so to avoid bigger issues, I just catch it.
//the printStackTrace is intended, it will show up in debug mode, but won't be displayed in standzrd mode
npe.printStackTrace();
return null;
} catch (AssetNotFoundException a) {
smartLog("Could not fully load Shader: Missing File: {0}", a.getMessage());
return null;
}
//Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.INFO, "Material succesfully reloaded");
//System.out.println("Material succesfully reloaded");
return dummy;
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:51,代码来源:MaterialPreviewRenderer.java
注:本文中的com.jme3.renderer.RendererException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论