crystalspace.jbind.impl.video.material
Class csMaterial

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.video.material.csMaterial
All Implemented Interfaces:
iBase, iMaterial, iPointer, iShaderVariableContext

public class csMaterial
extends csBase
implements iMaterial

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csMaterial(iPointer nPointer)
           
 
Method Summary
 void addVariable(csShaderVariable variable)
          Add a variable to this context.
 int fillVariableList(csShaderVariableProxyList list)
          Fill a csShaderVariableList.
 iEffectDefinition getEffect()
          Get the effect from the material.
 csRGBpixel getFlatColor()
          Get the flat color.
 csRGBpixel getFlatColor(boolean useTextureMean)
          Get the flat color.
 java.lang.String getName()
          Return the name of the interface
 float[] getReflection()
          Get light reflection parameters for this material.
 iShader getShader(int type)
          Get shader associated with a shader type.
 iTextureHandle getTexture()
          Get the base texture from the material.
 iTextureHandle getTexture(int name)
          Get a texture from the material.
 csTextureLayer getTextureLayer(int idx)
          Get a texture layer.
 int getTextureLayerCount()
          Get the number of texture layers.
 csShaderVariable getVariable(int name)
          Get a named variable from this context.
 csShaderVariable getVariableAdd(int name)
          Like GetVariable();, but it also adds it if doesn't exist already.
 csShaderVariable getVariableRecursive(int name)
          Get a named variable from this context, and any context above/outer.
 csShaderVariable getVariableRecursiveAdd(int name)
          Like GetVariable();, but it also adds it if doesn't exist already.
 int getVersion()
          Return the version of the interface
protected  boolean isNativePointerValidSafe(long pointer)
           
 void setEffect(iEffectDefinition ed)
          Set the material's effect.
 void setFlatColor(csRGBcolor col)
          Set the flat shading color.
 void setReflection(float oDiffuse, float oAmbient, float oReflection)
          Set the reflection parameters.
 void setShader(int type, iShader shader)
          Associate a shader with a shader type.
 
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, 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

csMaterial

public csMaterial(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
See Also:
iBase.getVersion()

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
See Also:
iBase.getName()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

getEffect

public iEffectDefinition getEffect()
Description copied from interface: iMaterial
Get the effect from the material. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getEffect in interface iMaterial
Returns:
See Also:
iMaterial.getEffect()

getFlatColor

public csRGBpixel getFlatColor()
Description copied from interface: iMaterial
Get the flat color. If the material has a texture assigned, this will return the mean texture color. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getFlatColor in interface iMaterial
Returns:
See Also:
iMaterial.getFlatColor()

getFlatColor

public csRGBpixel getFlatColor(boolean useTextureMean)
Description copied from interface: iMaterial
Get the flat color. If the material has a texture assigned, this will return the mean texture color. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getFlatColor in interface iMaterial
Parameters:
useTextureMean -
Returns:
See Also:
iMaterial.getFlatColor(boolean)

getReflection

public float[] getReflection()
Description copied from interface: iMaterial
Get light reflection parameters for this material. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getReflection in interface iMaterial
Returns:
See Also:
iMaterial.getReflection()

getShader

public iShader getShader(int type)
Description copied from interface: iMaterial
Get shader associated with a shader type. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getShader in interface iMaterial
Parameters:
type -
Returns:
See Also:
iMaterial.getShader(int)

getTexture

public iTextureHandle getTexture(int name)
Description copied from interface: iMaterial
Get a texture from the material. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getTexture in interface iMaterial
Parameters:
name -
Returns:
See Also:
iMaterial.getTexture(int)

getTexture

public iTextureHandle getTexture()
Description copied from interface: iMaterial
Get the base texture from the material. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getTexture in interface iMaterial
Returns:
See Also:
iMaterial.getTexture()

getTextureLayer

public csTextureLayer getTextureLayer(int idx)
Description copied from interface: iMaterial
Get a texture layer. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getTextureLayer in interface iMaterial
Parameters:
idx -
Returns:
See Also:
iMaterial.getTextureLayer(int)

getTextureLayerCount

public int getTextureLayerCount()
Description copied from interface: iMaterial
Get the number of texture layers. The base texture is not counted in this. Implemented in csMaterial, and csIsoMaterial.

Specified by:
getTextureLayerCount in interface iMaterial
Returns:
See Also:
iMaterial.getTextureLayerCount()

setEffect

public void setEffect(iEffectDefinition ed)
Description copied from interface: iMaterial
Set the material's effect. Implemented in csMaterial, and csIsoMaterial.

Specified by:
setEffect in interface iMaterial
Parameters:
ed -
See Also:
iMaterial.setEffect(crystalspace.jbind.interfaces.ivideo.effects.efdef.iEffectDefinition)

setFlatColor

public void setFlatColor(csRGBcolor col)
Description copied from interface: iMaterial
Set the flat shading color. Implemented in csMaterial, and csIsoMaterial.

Specified by:
setFlatColor in interface iMaterial
Parameters:
col -
See Also:
iMaterial.setFlatColor(crystalspace.jbind.impl.csgfx.rgbpixel.csRGBcolor)

setReflection

public void setReflection(float oDiffuse,
                          float oAmbient,
                          float oReflection)
Description copied from interface: iMaterial
Set the reflection parameters. Implemented in csMaterial, and csIsoMaterial.

Specified by:
setReflection in interface iMaterial
Parameters:
oDiffuse -
oAmbient -
oReflection -
See Also:
iMaterial.setReflection(float, float, float)

setShader

public void setShader(int type,
                      iShader shader)
Description copied from interface: iMaterial
Associate a shader with a shader type. Implemented in csMaterial, and csIsoMaterial.

Specified by:
setShader in interface iMaterial
Parameters:
type -
shader -
See Also:
iMaterial.setShader(int, crystalspace.jbind.interfaces.ivideo.shader.shader.iShader)

addVariable

public void addVariable(csShaderVariable variable)
Description copied from interface: iShaderVariableContext
Add a variable to this context. Referenced by GetVariableAdd();, and GetVariableRecursiveAdd();.

Specified by:
addVariable in interface iShaderVariableContext
Parameters:
variable -
See Also:
iShaderVariableContext.addVariable(crystalspace.jbind.impl.csgfx.shadervar.csShaderVariable)

fillVariableList

public int fillVariableList(csShaderVariableProxyList list)
Description copied from interface: iShaderVariableContext
Fill a csShaderVariableList. Return number of variables filled.

Specified by:
fillVariableList in interface iShaderVariableContext
Parameters:
list -
Returns:
See Also:
iShaderVariableContext.fillVariableList(crystalspace.jbind.impl.csgfx.shadervar.csShaderVariableProxyList)

getVariable

public csShaderVariable getVariable(int name)
Description copied from interface: iShaderVariableContext
Get a named variable from this context. Referenced by GetVariableAdd();.

Specified by:
getVariable in interface iShaderVariableContext
Parameters:
name -
Returns:
See Also:
iShaderVariableContext.getVariable(int)

getVariableAdd

public csShaderVariable getVariableAdd(int name)
Description copied from interface: iShaderVariableContext
Like GetVariable();, but it also adds it if doesn't exist already. Definition at line 69 of file shader.h. References AddVariable();, csStringID, and GetVariable();.

Specified by:
getVariableAdd in interface iShaderVariableContext
Parameters:
name -
Returns:
See Also:
iShaderVariableContext.getVariableAdd(int)

getVariableRecursive

public csShaderVariable getVariableRecursive(int name)
Description copied from interface: iShaderVariableContext
Get a named variable from this context, and any context above/outer. Referenced by GetVariableRecursiveAdd();.

Specified by:
getVariableRecursive in interface iShaderVariableContext
Parameters:
name -
Returns:
See Also:
iShaderVariableContext.getVariableRecursive(int)

getVariableRecursiveAdd

public csShaderVariable getVariableRecursiveAdd(int name)
Description copied from interface: iShaderVariableContext
Like GetVariable();, but it also adds it if doesn't exist already. Definition at line 84 of file shader.h. References AddVariable();, csStringID, and GetVariableRecursive();

Specified by:
getVariableRecursiveAdd in interface iShaderVariableContext
Parameters:
name -
Returns:
See Also:
iShaderVariableContext.getVariableRecursiveAdd(int)