@SuppressWarnings("unchecked") protected static Map<String, Object> getMap(final Object doc, final boolean verify) { if (!(doc instanceof Map<?, ?>)) { if (verify) { throw new Ardor3dException("Could not parse material. Expected Map at: " + doc); } else { return null; } } return (Map<String, Object>) doc; }
@SuppressWarnings("unchecked") protected static List<Object> getList(final Object doc, final boolean verify) { if (!(doc instanceof List<?>)) { if (verify) { throw new Ardor3dException("Could not parse material. Expected List at: " + doc); } else { return null; } } return (List<Object>) doc; } }
/** * <code>setExponent</code> sets the spot exponent of this light. This value represents how focused the light beam * is. * * @param exponent * the spot exponent of this light. Should be between 0-128 */ public void setExponent(final float exponent) { if (exponent < 0f || exponent > 128f) { throw new Ardor3dException("invalid exponent. Exponent must be between 0 and 128"); } _exponent = exponent; }
/** * <code>setAngle</code> sets the angle of focus of the spot light measured from the direction vector. Think of this * as the angle of a cone. Therefore, if you specify 10 degrees, you will get a 20 degree cone (10 degrees off * either side of the direction vector.) 180 degrees means radiate in all directions. * * @param angle * the angle (in degrees) which must be between 0 and 90 (inclusive) or the special case 180. */ public void setAngle(final float angle) { if (angle < 0f || (angle > 90f && angle != 180f)) { throw new Ardor3dException("invalid angle. Angle must be between 0 and 90, or 180"); } _angle = angle; }
/** * <code>setRoughness</code> sets the new roughness value of the heightmap. Roughness determines how chaotic the * terrain will be. Where 1 is perfectly self-similar, > 1 early iterations have a disproportionately large effect * creating smooth terrain, and < 1 late iteraions have a disproportionately large effect creating chaotic terrain. * * @param roughness * how chaotic will the heightmap be. */ public void setRoughness(final float roughness) { if (roughness < 0) { throw new Ardor3dException("roughness must be greater than 0"); } this.roughness = roughness; }
/** * <code>setRoughness</code> sets the new roughness value of the heightmap. Roughness determines how chaotic the * terrain will be. Where 1 is perfectly self-similar, > 1 early iterations have a disproportionately large effect * creating smooth terrain, and < 1 late iteraions have a disproportionately large effect creating chaotic terrain. * * @param roughness * how chaotic will the heightmap be. */ public void setRoughness(final float roughness) { if (roughness < 0) { throw new Ardor3dException("roughness must be greater than 0"); } this.roughness = roughness; }
protected static int getGLDataType(final Buffer buffer) { if (buffer instanceof FloatBuffer) { return GL11C.GL_FLOAT; } else if (buffer instanceof ByteBuffer) { return GL11C.GL_BYTE; } else if (buffer instanceof IntBuffer) { return GL11C.GL_INT; } else if (buffer instanceof ShortBuffer) { return GL11C.GL_SHORT; } else { throw new Ardor3dException("Unhandled buffer type: " + buffer.getClass().getName()); } }
public void removeFromQueue(final Spatial spatial, final RenderBucketType type) { if (type == RenderBucketType.Inherit || type == RenderBucketType.Skip) { throw new Ardor3dException("Can't remove spatial from bucket of type: " + type); } final RenderBucket renderBucket = getRenderBucket(type); if (renderBucket != null) { renderBucket.remove(spatial); } else { throw new Ardor3dException("No bucket exists of type: " + type); } }
private void deactivate() { if (_active == 1) { try { giveBackContext(); } catch (final LWJGLException e) { logger.logp(Level.SEVERE, this.getClass().toString(), "deactivate()", "Exception", e); throw new Ardor3dException(); } } _active--; }
public void removeFromQueue(final Spatial spatial, final RenderBucketType type) { if (type == RenderBucketType.Inherit || type == RenderBucketType.Skip) { throw new Ardor3dException("Can't remove spatial from bucket of type: " + type); } final RenderBucket renderBucket = getRenderBucket(type); if (renderBucket != null) { renderBucket.remove(spatial); } else { throw new Ardor3dException("No bucket exists of type: " + type); } }
public void addToQueue(final Spatial spatial, final RenderBucketType type) { if (type == RenderBucketType.Inherit || type == RenderBucketType.Skip) { throw new Ardor3dException("Can't add spatial to bucket of type: " + type); } if (Constants.enableInstancedGeometrySupport && prepareForInstancing(spatial)) { return; } final RenderBucket renderBucket = getRenderBucket(type); if (renderBucket != null) { renderBucket.add(spatial); } else { throw new Ardor3dException("No bucket exists of type: " + type); } }
public void addToQueue(final Spatial spatial, final RenderBucketType type) { if (type == RenderBucketType.Inherit || type == RenderBucketType.Skip) { throw new Ardor3dException("Can't add spatial to bucket of type: " + type); } if (Constants.enableInstancedGeometrySupport && prepareForInstancing(spatial)) { return; } final RenderBucket renderBucket = getRenderBucket(type); if (renderBucket != null) { renderBucket.add(spatial); } else { throw new Ardor3dException("No bucket exists of type: " + type); } }
public void checkCardError() throws Ardor3dException { try { org.lwjgl.opengl.Util.checkGLError(); } catch (final OpenGLException exception) { throw new Ardor3dException("Error in opengl: " + exception.getMessage(), exception); } }
public void setupBuckets(final RenderBucketType[] renderBucketTypes, final RenderBucket[] buckets) { if (renderBucketTypes.length != buckets.length) { throw new Ardor3dException("Can't setup buckets, RenderBucketType and RenderBucket counts don't match."); } removeRenderBuckets(); for (int i = 0; i < renderBucketTypes.length; i++) { setRenderBucket(renderBucketTypes[i], buckets[i]); } }
public void setupBuckets(final RenderBucketType[] renderBucketTypes, final RenderBucket[] buckets) { if (renderBucketTypes.length != buckets.length) { throw new Ardor3dException("Can't setup buckets, RenderBucketType and RenderBucket counts don't match."); } removeRenderBuckets(); for (int i = 0; i < renderBucketTypes.length; i++) { setRenderBucket(renderBucketTypes[i], buckets[i]); } }
public void makeCurrentContext() throws Ardor3dException { try { _canvasCallback.makeCurrent(); GLContext.useContext(_context); ContextManager.switchContext(this); } catch (final LWJGLException e) { throw new Ardor3dException("Failed to claim OpenGL context.", e); } }
/** * Mark a specific data buffer as dirty in this MeshData. Also calls {@link #markBuffersDirty()} * * @param key * the key of the buffer to mark dirty. * @throws Ardor3DException * if buffer is not found */ public void markBufferDirty(final String key) { final AbstractBufferData<?> data = getCoords(key); if (data == null) { throw new Ardor3dException("Buffer not found: " + key); } data.markDirty(); markBuffersDirty(); }
public void checkCardError() throws Ardor3dException { final GL gl = GLContext.getCurrentGL(); final GLU glu = new GLU(); try { final int errorCode = gl.glGetError(); if (errorCode != GL.GL_NO_ERROR) { throw new GLException(glu.gluErrorString(errorCode)); } } catch (final GLException exception) { throw new Ardor3dException("Error in opengl: " + exception.getMessage(), exception); } }
public void unsetOrtho() { if (!_inOrthoMode) { throw new Ardor3dException("Not in Orthographic mode."); } // remove ortho mode, and go back to original // state final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); LwjglRendererUtil.switchMode(matRecord, GL11.GL_PROJECTION); GL11.glPopMatrix(); LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); GL11.glPopMatrix(); _inOrthoMode = false; }
public void unsetOrtho() { if (!_inOrthoMode) { throw new Ardor3dException("Not in Orthographic mode."); } // remove ortho mode, and go back to original // state final JoglRendererRecord matRecord = (JoglRendererRecord) ContextManager.getCurrentContext() .getRendererRecord(); JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_PROJECTION); matRecord.getMatrixBackend().popMatrix(); JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); matRecord.getMatrixBackend().popMatrix(); _inOrthoMode = false; }