📄 renderer.java
字号:
/**
*
* <code>unsetOrhto</code> unsets the display system from orthographic
* mode back into regular projection mode. If the system is not in
* orthographic mode a <code>JmeException</code> is thrown.
*
*
*/
public abstract void unsetOrtho();
/**
*
* <code>takeScreenShot</code> saves the current buffer to a png file. The
* filename is provided, .png will be appended to the end of the name.
*
* @param filename
* the name of the screenshot file.
* @return true if the screen capture was successful, false otherwise.
*/
public abstract boolean takeScreenShot(String filename);
/**
* <code>grabScreenContents</code> reads a block of data as bytes from the
* current framebuffer. The format determines how many bytes per pixel are
* read and thus how big the buffer must be that you pass in.
*
* @param buff
* a buffer to store contents in.
* @param format
* the format to read in bytes for.
* @param x -
* x starting point of block
* @param y -
* y starting point of block
* @param w -
* width of block
* @param h -
* height of block
*/
public abstract void grabScreenContents(ByteBuffer buff, Image.Format format, int x, int y, int w, int h);
/**
* <code>draw</code> renders a scene. As it recieves a base class of
* <code>Spatial</code> the renderer hands off management of the scene to
* spatial for it to determine when a <code>Geometry</code> leaf is
* reached.
*
* @param s
* the scene to render.
*/
public abstract void draw(Spatial s);
/**
* <code>draw</code> renders a single TriMesh to the back buffer.
*
* @param mesh
* the mesh to be rendered.
*/
public abstract void draw(TriMesh mesh);
/**
* <code>draw</code> renders a single QuadMesh to the back buffer.
*
* @param mesh
* the mesh to be rendered.
*/
public abstract void draw(QuadMesh mesh);
/**
* <code>draw</code> renders a single Point collection to the back buffer.
*
* @param point
* the points to be rendered.
*/
public abstract void draw(Point point);
/**
* <code>draw</code> renders a single Line collection to the back buffer.
*
* @param line
* the line to be rendered.
*/
public abstract void draw(Line line);
/**
*
* <code>draw</code> renders a curve to the back buffer.
*
* @param c
* the curve to be rendered.
*/
public abstract void draw(Curve c);
/**
*
* <code>draw</code> renders text to the back buffer.
*
* @param t
* the text object to be rendered.
*/
public abstract void draw(Text t);
/**
* <code>flush</code> tells opengl to send through all currently waiting
* commands in the buffer.
*/
public abstract void flush();
/**
* <code>finish</code> is similar to flush, however it blocks until all
* waiting OpenGL commands have been finished.
*/
public abstract void finish();
/**
* Get the render queue associated with this Renderer.
*
* @return RenderQueue
*/
public RenderQueue getQueue() {
return queue;
}
/**
* Return true if this renderer is in the middle of processing its
* RenderQueue.
*
* @return boolean
*/
public boolean isProcessingQueue() {
return processingQueue;
}
/**
* Check a given Spatial to see if it should be queued. return true if it
* was queued.
*
* @param s
* Spatial to check
* @return true if it was queued.
*/
public abstract boolean checkAndAdd(Spatial s);
/**
* Return true if the system running this supports VBO
*
* @return boolean
*/
public abstract boolean supportsVBO();
/**
* See Renderer.isHeadless()
*
* @return boolean
*/
public boolean isHeadless() {
return headless;
}
/**
* See Renderer.setHeadless()
*/
public void setHeadless(boolean headless) {
this.headless = headless;
}
/**
* Retrieve the width set on this renderer.
*
* @return width
*/
public int getWidth() {
return width;
}
/**
* Retrieve the height set on this renderer.
*
* @return height
*/
public int getHeight() {
return height;
}
/**
* Reinitialize the renderer with the given width/height. Also calls resize
* on the attached camera if present.
*
* @param width
* int
* @param height
* int
*/
public abstract void reinit(int width, int height);
/**
* Generate a DisplayList for drawing the given Geometry.
*
* @param geom
* the geometry to make a display list for
* @return the id of the list
*/
public abstract int createDisplayList(Geometry geom);
/**
* Releases a DisplayList from the card.
*
* @param listId
* the id of the display list to release
*/
public abstract void releaseDisplayList(int listId);
/**
* Sets an offset to the zbuffer to be used when comparing an incoming
* polygon for depth buffer pass/fail.
*
* @param factor
* Specifies a scale factor that is used to create a variable
* depth offset for each polygon. The initial value is 0.
* @param offset
* Is multiplied by an implementation-specific value to create a
* constant depth offset. The initial value is 0.
*/
public abstract void setPolygonOffset(float factor, float offset);
/**
* Removes any previously set offset from the renderer.
*/
public abstract void clearPolygonOffset();
/**
* Checks the VBO cache to see if this Buffer is mapped to a VBO-id.
* If it does the mapping will be removed from the cache and the VBO with the
* VBO-id found will be deleted.
*
* If no mapped VBO-id is found, this method does not do anything else.
*
* @param buffer
* The Buffer who's associated VBO should be deleted.
*/
public abstract void deleteVBO(Buffer buffer);
/**
* Attempts to delete the VBO with this VBO id. Ignores ids < 1.
*
* @param vboid
*/
public abstract void deleteVBO(int vboid);
/**
* Clears all entries from the VBO cache. Does not actually delete any VBO
* buffer, only all mappings between Buffers and VBO-ids.
*
*/
public abstract void clearVBOCache();
/**
* Removes the mapping between this Buffer and it's VBO-id. Does not
* actually delete the VBO. <br>
* This method is usefull if you want to use the same Buffer to create
* several VBOs. After a VBO is created for this Buffer, update the Buffer
* and remove it from the VBO cache. You can now reuse the same buffer with
* another Geometry object. <br>
* If no association is found, this method does nothing.
*
* @param buffer
* The nio Buffer whose associated VBO should be deleted.
* @return An int wrapped in an Integer object that's the VBO-id of the VBO
* previously mapped to this Buffer, or null is no mapping existed.
*/
public abstract Integer removeFromVBOCache(Buffer buffer);
/**
* Create a renderstate via a given renderstate type.
*
* @param type
* one of RenderState.RS_****
* @return the new RenderState or null if an invalid type is given.
* @deprecated As of 2.0, use {@link #createState(com.jme.scene.state.RenderState.StateType)} instead.
*/
public RenderState createState(int type) {
return createState(RenderState.StateType.values()[type]);
}
/**
* Create a {@link RenderState} via a given {@link RenderState.StateType} type.
*
* @param types
* one of {@link RenderState.StateType} types
* @return the new {@link RenderState} or null if an invalid type is given.
*/
public RenderState createState(RenderState.StateType type) {
switch (type) {
case Blend:
return createBlendState();
case Clip:
return createClipState();
case ColorMask:
return createColorMaskState();
case Cull:
return createCullState();
case Fog:
return createFogState();
case FragmentProgram:
return createFragmentProgramState();
case GLSLShaderObjects:
return createGLSLShaderObjectsState();
case Light:
return createLightState();
case Material:
return createMaterialState();
case Shade:
return createShadeState();
case Stencil:
return createStencilState();
case Texture:
return createTextureState();
case VertexProgram:
return createVertexProgramState();
case Wireframe:
return createWireframeState();
case ZBuffer:
return createZBufferState();
default:
return null;
}
}
/**
* @return a generated StateRecord representing gl line values for a gl
* context.
*/
public abstract StateRecord createLineRecord();
/**
* @return a generated StateRecord representing basic values for this
* renderer context.
*/
public abstract StateRecord createRendererRecord();
/**
* Updates a region of the content area of the provided texture using the
* specified region of the given data.
*
* @param dstTexture
* the texture to be updated
* @param dstX
* the x offset relative to the lower-left corner of this texture
* where the update will be applied
* @param dstY
* the y offset relative to the lower-left corner of this texture
* where the update will be applied
* @param srcImage
* the image data to be uploaded to the texture
* @param srcX
* the x offset relative to the lower-left corner of the supplied
* buffer from which to fetch the update rectangle
* @param srcY
* the y offset relative to the lower-left corner of the supplied
* buffer from which to fetch the update rectangle
* @param width
* the width of the region to be updated
* @param height
* the height of the region to be updated
* @throws JmeException
* if unable to update the texture
* @throws UnsupportedOperationException
* if updating for the provided texture type is unsupported
* @see com.sun.opengl.util.texture.Texture#updateSubImage(com.sun.opengl.util.texture.TextureData,
* int, int, int, int, int, int, int)
* @since 2.0
*/
public abstract void updateTextureSubImage(Texture dstTexture, int dstX,
int dstY, Image srcImage, int srcX, int srcY, int width, int height)
throws JmeException, UnsupportedOperationException;
/**
* Check the underlying rendering system (opengl, etc.) for exceptions.
* @throws JmeException if an error is found.
*/
public abstract void checkCardError() throws JmeException;
/**
* Perform any necessary cleanup operations such as deleting VBOs, etc.
*/
public abstract void cleanup();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -