sdr 0.7

net.cscott.sdr.anim
Class TexturedQuad

java.lang.Object
  extended by com.jme.scene.SceneElement
      extended by com.jme.scene.Spatial
          extended by com.jme.scene.Geometry
              extended by com.jme.scene.TriMesh
                  extended by com.jme.scene.shape.Quad
                      extended by net.cscott.sdr.anim.TexturedQuad
All Implemented Interfaces:
com.jme.util.export.Savable, Serializable

public class TexturedQuad
extends com.jme.scene.shape.Quad

A "TexturedQuad" is textured with a BufferedImage which the client can draw into. This makes it easy to write subclasses to generate dynamic HUD elements by drawing into the Image.

Version:
$Id: TexturedQuad.java,v 1.5 2006-11-22 20:56:55 cananian Exp $
Author:
C. Scott Ananian
See Also:
Serialized Form

Field Summary
 com.jme.image.Texture texture
          The Texture we will ultimately generate.
 
Fields inherited from class com.jme.scene.Geometry
batchList
 
Fields inherited from class com.jme.scene.Spatial
geometricalControllers, localRotation, localScale, localTranslation, parent, worldRotation, worldScale, worldTranslation
 
Fields inherited from class com.jme.scene.SceneElement
COMPOSITE_MESH, CULL_ALWAYS, CULL_DYNAMIC, CULL_INHERIT, CULL_NEVER, cullMode, frustrumIntersects, GEOMBATCH, GEOMETRY, isCollidable, lightCombineMode, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, NM_GL_NORMALIZE_IF_SCALED, NM_GL_NORMALIZE_PROVIDED, NM_INHERIT, NM_OFF, NM_USE_PROVIDED, NODE, normalsMode, QUADBATCH, queueDistance, renderQueueMode, renderStateList, SHARED_MESH, SHAREDBATCH, SKY_BOX, TERRAIN_BLOCK, TERRAIN_PAGE, textureCombineMode, TRIANGLEBATCH, TRIMESH, worldBound, zOrder
 
Constructor Summary
TexturedQuad(String nodeName, int textureSize)
          Creates a TexturedQuad which is textured with a BufferedImage of the specified size.
 
Method Summary
 void finalize()
          Release the texture when this TexturedQuad is no longer being used.
 BufferedImage getTextureImage()
          Return an appropriate BufferedImage in which to draw the desired texture.
 void updateTexture(BufferedImage textureImage)
          Update the texture on this quad.
 
Methods inherited from class com.jme.scene.shape.Quad
getCenter, initialize, resize
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, findCollisions, findTriangleCollision, findTrianglePick, getBatch, getIndexBuffer, getMeshAsTriangles, getMeshAsTrianglesVertices, getTriangle, getTriangle, getTriangle, getTriangle, getTriangleCount, getType, hasCollision, hasTriangleCollision, hasTriangleCollision, reconstruct, reconstruct, setIndexBuffer, setupBatchList
 
Methods inherited from class com.jme.scene.Geometry
addBatch, applyRenderState, clearBatches, copyTextureCoords, copyTextureCoords, findPick, getBatchCount, getBatchIndex, getColorBuffer, getNormalBuffer, getNumberOfUnits, getTextureBuffer, getTextureBuffers, getVBOInfo, getVertexBuffer, getVertexCount, getWorldCoords, getWorldCoords, getWorldNormals, getWorldNormals, lockBounds, lockMeshes, lockShadows, lockTransforms, randomVertex, read, reconstruct, reconstruct, removeBatch, removeBatch, setColorBuffer, setDefaultColor, setModelBound, setNormalBuffer, setRandomColors, setSolidColor, setTextureBuffer, setTextureBuffer, setVBOInfo, setVBOInfo, setVertexBuffer, swapBatches, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldData, write
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, getController, getControllers, getCullMode, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getNormalsMode, getParent, getRenderQueueMode, getTextureCombineMode, getUserData, getWorldRotation, getWorldScale, getWorldTranslation, localToWorld, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setParent, setUserData, setZOrder, updateGeometricState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, worldToLocal
 
Methods inherited from class com.jme.scene.SceneElement
clearRenderState, getClassTag, getLastFrustumIntersection, getLocalCullMode, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalTextureCombineMode, getLocks, getName, getRenderState, getWorldBound, getZOrder, isCollidable, lock, lock, lockBranch, lockMeshes, setCullMode, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocks, setLocks, setName, setNormalsMode, setRenderQueueMode, setRenderState, setTextureCombineMode, setZOrder, toString, unlock, unlock, unlockBranch, unlockMeshes, updateRenderState, updateRenderState
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Field Detail

texture

public final com.jme.image.Texture texture
The Texture we will ultimately generate.

Constructor Detail

TexturedQuad

public TexturedQuad(String nodeName,
                    int textureSize)
Creates a TexturedQuad which is textured with a BufferedImage of the specified size. For example, to use a 64x64 texture, pass in '64' as the textureSize. The quad by default is the same size as the image; you can call Quad.resize(float, float) yourself if you want to scale it. You may also want to change the texture minification and magnification filters in that case.

To update the texture, get the backing BufferedImage with getTextureImage(), draw on it, and then give it to updateTexture(BufferedImage). By default, the backing image is held with a soft reference to allow it to be reclaimed by the garbage collector if the texture is not "frequently" changed; if you would like to use the previous contents of the backing image to do an incremental update, you are responsible for keeping a hard reference to it yourself.

Method Detail

getTextureImage

public BufferedImage getTextureImage()
Return an appropriate BufferedImage in which to draw the desired texture. After you have drawn what you like, give this BufferedImage to the updateTexture(BufferedImage) method. Note that the returned image will always be completely transparent, even if internally we're reusing an old reference.


updateTexture

public void updateTexture(BufferedImage textureImage)
Update the texture on this quad. This method adds the update to the update queue, so it will not take effect immediately.


finalize

public void finalize()
Release the texture when this TexturedQuad is no longer being used.

Overrides:
finalize in class Object

sdr 0.7

Copyright © 2006-2009 C. Scott Ananian