crystalspace.jbind.impl.video.txtmgr
Class csTextureManager

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.video.txtmgr.csTextureManager
All Implemented Interfaces:
iBase, iPointer, iTextureManager

public class csTextureManager
extends csBase
implements iTextureManager

Author:
qan To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csTextureManager(iPointer nPointer)
           
 
Method Summary
 iSuperLightmap createSuperLightmap(int width, int height)
          Create a new super lightmap with the specified dimensions.
 void freeImages()
          Call this function if you want to release all iImage's as given to this texture manager.
 void freeMaterials()
          Call this function if you want to release all iMaterial's as given to this texture manager.
static java.lang.Class getInterfaceClass()
           
static java.lang.String getInterfaceName()
           
static int getInterfaceVersion()
           
 float[] getLightmapRendererCoords(int slmWidth, int slmHeight, int lm_x1, int lm_y1, int lm_x2, int lm_y2)
          Retrieve the coordinates of a lightmap in the its superlightmap, in a system the renderer uses internally.
 int[] getMaxTextureSize()
          Request maximum texture dimensions.
 java.lang.String getName()
          Return the name of the interface
 int getTextureFormat()
          Query the basic format of textures that can be registered with this texture manager.
 int getVersion()
          Return the version of the interface
static void initSCF()
           
protected  boolean isNativePointerValidSafe()
           
 void prepareMaterials()
          Prepare all materials.
 void prepareTextures()
          After all textures have been added, this function does all needed calculations (palette, lookup tables, mipmaps, ...);.
 iMaterialHandle registerMaterial(iMaterial material)
          Register a material.
 iMaterialHandle registerMaterial(iTextureHandle txthandle)
          Register a material based on a texture handle.
 iTextureHandle registerTexture(iImage image, int flags)
          Register a texture.
 void setVerbose(boolean vb)
          Set verbose mode on/off.
 
Methods inherited from class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, isNativePointerValidSafe, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csTextureManager

public csTextureManager(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase

getName

public java.lang.String getName()
Description copied from interface: iBase
Return the name of the interface

Specified by:
getName in interface iBase
Specified by:
getName in class csBase

initSCF

public static void initSCF()

setVerbose

public void setVerbose(boolean vb)
Description copied from interface: iTextureManager
Set verbose mode on/off. In verbose mode, texture manager will Printf(); through the system driver during all initialization and preparation operations.

Specified by:
setVerbose in interface iTextureManager
Parameters:
vb -

getInterfaceVersion

public static int getInterfaceVersion()

getInterfaceName

public static java.lang.String getInterfaceName()

getInterfaceClass

public static java.lang.Class getInterfaceClass()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe()

createSuperLightmap

public iSuperLightmap createSuperLightmap(int width,
                                          int height)
Description copied from interface: iTextureManager
Create a new super lightmap with the specified dimensions.

Specified by:
createSuperLightmap in interface iTextureManager
Parameters:
width -
height -
Returns:
See Also:
iTextureManager.createSuperLightmap(int, int)

freeImages

public void freeImages()
Description copied from interface: iTextureManager
Call this function if you want to release all iImage's as given to this texture manager. After FreeImages(); has been called it is no longer allowed to call Prepare(); again. So the advantage of calling FreeImages(); is that you gain memory (may be a lot); but the disadvantage is that when you want to add textures later you have to reload them all and start all over.

Specified by:
freeImages in interface iTextureManager
See Also:
iTextureManager.freeImages()

freeMaterials

public void freeMaterials()
Description copied from interface: iTextureManager
Call this function if you want to release all iMaterial's as given to this texture manager.

Specified by:
freeMaterials in interface iTextureManager
See Also:
iTextureManager.freeMaterials()

getLightmapRendererCoords

public float[] getLightmapRendererCoords(int slmWidth,
                                         int slmHeight,
                                         int lm_x1,
                                         int lm_y1,
                                         int lm_x2,
                                         int lm_y2)
Description copied from interface: iTextureManager
Retrieve the coordinates of a lightmap in the its superlightmap, in a system the renderer uses internally. Calculate lightmap U/Vs within this bounds when they are intended to be passed to the renderer.

Specified by:
getLightmapRendererCoords in interface iTextureManager
Parameters:
slmWidth -
slmHeight -
lm_x1 -
lm_y1 -
lm_x2 -
lm_y2 -
Returns:
See Also:
iTextureManager.getLightmapRendererCoords(int, int, int, int, int, int)

getMaxTextureSize

public int[] getMaxTextureSize()
Description copied from interface: iTextureManager
Request maximum texture dimensions.

Specified by:
getMaxTextureSize in interface iTextureManager
Returns:
See Also:
iTextureManager.getMaxTextureSize()

getTextureFormat

public int getTextureFormat()
Description copied from interface: iTextureManager
Query the basic format of textures that can be registered with this texture manager. It is very likely that the texture manager will reject the texture if it is in an improper format. The alpha channel is optional; the texture can have it and can not have it. Only the bits that fit the CS_IMGFMT_MASK mask matters.

Specified by:
getTextureFormat in interface iTextureManager
Returns:
See Also:
iTextureManager.getTextureFormat()

prepareMaterials

public void prepareMaterials()
Description copied from interface: iTextureManager
Prepare all materials.

Specified by:
prepareMaterials in interface iTextureManager
See Also:
iTextureManager.prepareMaterials()

prepareTextures

public void prepareTextures()
Description copied from interface: iTextureManager
After all textures have been added, this function does all needed calculations (palette, lookup tables, mipmaps, ...);. PrepareTextures (); must be able to handle being called twice or more without ill effects. Note that it is in this stage that the original image that is attached to a texture is scaled so that it fits hardware requirements. So it is important to realize that calling this function may actually change the images from which you created the textures!

Specified by:
prepareTextures in interface iTextureManager
See Also:
iTextureManager.prepareTextures()

registerMaterial

public iMaterialHandle registerMaterial(iMaterial material)
Description copied from interface: iTextureManager
Register a material. The input material is IncRef'd and DecRef'ed later when FreeMaterials (); is called or the material handle is destroyed by calling DecRef on it enough times. If you want to keep the input material make sure you have called IncRef yourselves. The material is unregistered at destruction, i.e. as soon as the last reference to the material handle is released.

Specified by:
registerMaterial in interface iTextureManager
Parameters:
material -
Returns:
See Also:
iTextureManager.registerMaterial(crystalspace.jbind.interfaces.ivideo.material.iMaterial)

registerMaterial

public iMaterialHandle registerMaterial(iTextureHandle txthandle)
Description copied from interface: iTextureManager
Register a material based on a texture handle. This is a short-cut to quickly make materials based on a single texture. The material is unregistered at destruction, i.e. as soon as the last reference to the material handle is released.

Specified by:
registerMaterial in interface iTextureManager
Parameters:
txthandle -
Returns:
See Also:
iTextureManager.registerMaterial(crystalspace.jbind.interfaces.ivideo.texture.iTextureHandle)

registerTexture

public iTextureHandle registerTexture(iImage image,
                                      int flags)
Description copied from interface: iTextureManager
Register a texture. The given input image is IncRef'd and DecRef'ed later when FreeImages (); is called. If you want to keep the input image make sure you have called IncRef yourselves. The texture is not converted immediately. Instead, you can make intermediate calls to iTextureHandle::SetKeyColor ();. Finally, if you want to merge the texture into the current environment, you should call txt->Prepare();. Alternatively you can call the PrepareTextures (); method to compute a optimal palette and convert all the textures into the internal format. This function returns a handle which should be given to the 3D rasterizer or 2D driver when drawing or otherwise using the texture. The `flags' contains one or several of CS_TEXTURE_XXX flags OR'ed together. They define the mode texture is going to be used in. The texture manager will reject the texture if it is an inappropiate format (see GetTextureFormat (); method);. The texture is unregistered at destruction, i.e. as soon as the last reference to the texture handle is released. If CS_USE_NEW_RENDERER is enabled param target specifies the texture target. Defines for that can be found in ivideo/texture.h Note! This function will NOT scale the texture to fit hardware restrictions. This is done later when Prepare(); is called.

Specified by:
registerTexture in interface iTextureManager
Parameters:
image -
flags -
Returns:
See Also:
iTextureManager.registerTexture(crystalspace.jbind.interfaces.igraphic.image.iImage, int)