crystalspace.jbind.impl.engine.rview
Class csRenderView

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.engine.rview.csRenderView
All Implemented Interfaces:
iBase, iPointer, iRenderView

public class csRenderView
extends csBase
implements iRenderView

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csRenderView(iPointer nPointer)
           
 
Method Summary
 boolean addedFogInfo()
          Return true if fog info has been added
 void attachRenderContextData(iPointer key, iBase data)
          Attach data to the current render context
 void calculateFogMesh(csTransform tr_o2c, G3DPolygonMesh mesh)
           
 void calculateFogMesh(csTransform tr_o2c, G3DTriangleMesh mesh)
           
 void calculateFogPolygon(G3DPolygonDP poly)
           
 void calculateFogPolygon(G3DPolygonDPFX poly)
           
 boolean clipBBox(csBox2 sbox, csBox3 cbox, int clip_portal, int clip_plane, int clip_z_plane)
          Check if the screen bounding box of an object is visible in this render view.
 boolean clipBSphere(csReversibleTransform o2c, csSphere sphere, int clip_portal, int clip_plane, int clip_z_plane)
          Check if the given bounding sphere(in object space coordinates) is visibile in this render view.
 iCamera createNewCamera()
          Create a new camera in the current render context.
 void createRenderContext()
          Create a new render context.
 void deleteRenderContextData(iPointer key)
          Delete all data with the given key on the current render context.
 iBase findRenderContextData(iPointer key)
          Look for data on the current render context.
 iCamera getCamera()
          Get the current camerapublic
 iClipper2D getClipper()
          Get the 2D clipper for this view
 csPlane3 getClipPlane()
          Get the clip plane
 boolean getClipPlane(csPlane3 pl)
          Get the 3D clip plane that should be used to clip all geometry.
 iEngine getEngine()
          Get the engine
 csFogInfo getFirstFogInfo()
          Every fogged sector we encountered results in an extra structure in the following list.
 void getFrustum(float lx, float rx, float ty, float by)
          Get the frustum
 iGraphics2D getGraphics2D()
          Get the 2D graphics subsystem
 iGraphics3D getGraphics3D()
          Get the 3D graphics subsystem
 iPortal getLastPortal()
          Get the portal we last traversed through
 java.lang.String getName()
          Return the name of the interface
 iCamera getOriginalCamera()
          Get the original camera for this render view.
 iSector getPreviousSector()
          Get previous sector
 csRenderContext getRenderContext()
          Get the current render context
 int getRenderRecursionLevel()
          Get render recursion level
 iSector getThisSector()
          Get current sector
 csRenderContextFrustum getTopFrustum()
          Get the top level frustum(corresponding with SetFrustum())
 int getVersion()
          Return the version of the interface
 boolean isClipperRequired()
          If true then we have to clip all objects to the portal frustum (returned with GetClipper()).
protected  boolean isNativePointerValidSafe(long pointer)
           
 void resetFogInfo()
          Reset fog info
 void restoreRenderContext(csRenderContext original)
          Restore a render context.
 void setClipper(iClipper2D clip)
          Set the 2D clipper for this view
 void setClipPlane(csPlane3 pl)
          Set the 3D clip plane that should be used to clip all geometry
 void setFirstFogInfo(csFogInfo fi)
          Set the first fog info
 void setFrustum(float lx, float rx, float ty, float by)
          Set the view frustum at z = 1.
 void setLastPortal(iPortal portal)
          Set the last portal
 void setPreviousSector(iSector s)
          Set the previous sector
 void setRenderRecursionLevel(int rec)
          Set render recursion level
 void setThisSector(iSector s)
          Set the current sector
 boolean testBSphere(csReversibleTransform o2c, csSphere sphere)
          Test if the given bounding sphere(in object space coordinates) is visibile in this render view.
 void useClipFrustum(boolean u)
          Enable the use of a clip frustum
 void useClipPlane(boolean u)
          Enable the use of a clip plane
 
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

csRenderView

public csRenderView(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)

addedFogInfo

public boolean addedFogInfo()
Description copied from interface: iRenderView
Return true if fog info has been added

Specified by:
addedFogInfo in interface iRenderView
Returns:
See Also:
iRenderView.addedFogInfo()

attachRenderContextData

public void attachRenderContextData(iPointer key,
                                    iBase data)
Description copied from interface: iRenderView
Attach data to the current render context

Specified by:
attachRenderContextData in interface iRenderView
Parameters:
key -
data -
See Also:
iRenderView.attachRenderContextData(crystalspace.jbind.interfaces.iPointer, crystalspace.jbind.interfaces.iutil.scf.iBase)

calculateFogMesh

public void calculateFogMesh(csTransform tr_o2c,
                             G3DPolygonMesh mesh)
Specified by:
calculateFogMesh in interface iRenderView
Parameters:
tr_o2c -
mesh -
See Also:
iRenderView.calculateFogMesh(crystalspace.jbind.impl.csgeom.transfrm.csTransform, crystalspace.jbind.impl.video.graph3d.G3DPolygonMesh)

calculateFogMesh

public void calculateFogMesh(csTransform tr_o2c,
                             G3DTriangleMesh mesh)
Specified by:
calculateFogMesh in interface iRenderView
Parameters:
tr_o2c -
mesh -
See Also:
iRenderView.calculateFogMesh(crystalspace.jbind.impl.csgeom.transfrm.csTransform, crystalspace.jbind.impl.video.graph3d.G3DTriangleMesh)

calculateFogPolygon

public void calculateFogPolygon(G3DPolygonDPFX poly)
Specified by:
calculateFogPolygon in interface iRenderView
Parameters:
poly -
See Also:
iRenderView.calculateFogPolygon(crystalspace.jbind.impl.video.graph3d.G3DPolygonDPFX)

calculateFogPolygon

public void calculateFogPolygon(G3DPolygonDP poly)
Specified by:
calculateFogPolygon in interface iRenderView
Parameters:
poly -
See Also:
iRenderView.calculateFogPolygon(crystalspace.jbind.impl.video.graph3d.G3DPolygonDP)

clipBBox

public boolean clipBBox(csBox2 sbox,
                        csBox3 cbox,
                        int clip_portal,
                        int clip_plane,
                        int clip_z_plane)
Description copied from interface: iRenderView
Check if the screen bounding box of an object is visible in this render view. If true is returned(visible) then clip_plane, clip_z_plane, and clip_portal will be set to the right value depending on wether or not clipping is wanted. This function also does far plane clipping.

Specified by:
clipBBox in interface iRenderView
Parameters:
sbox -
cbox -
clip_portal -
clip_plane -
clip_z_plane -
Returns:
See Also:
iRenderView.clipBBox(crystalspace.jbind.impl.csgeom.box.csBox2, crystalspace.jbind.impl.csgeom.box.csBox3, int, int, int)

clipBSphere

public boolean clipBSphere(csReversibleTransform o2c,
                           csSphere sphere,
                           int clip_portal,
                           int clip_plane,
                           int clip_z_plane)
Description copied from interface: iRenderView
Check if the given bounding sphere(in object space coordinates) is visibile in this render view. The given transformation should transform object to camera space. If the sphere is visible this function will also initialize the clip_plane, clip_z_plane, and clip_portal fields which can be used for DrawTriangleMesh or DrawPolygonMesh.

Specified by:
clipBSphere in interface iRenderView
Parameters:
o2c -
sphere -
clip_portal -
clip_plane -
clip_z_plane -
Returns:
See Also:
iRenderView.clipBSphere(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.sphere.csSphere, int, int, int)

createNewCamera

public iCamera createNewCamera()
Description copied from interface: iRenderView
Create a new camera in the current render context. This function will create a new camera based on the current one. The new camera reference is returned.

Specified by:
createNewCamera in interface iRenderView
Returns:
See Also:
iRenderView.createNewCamera()

createRenderContext

public void createRenderContext()
Description copied from interface: iRenderView
Create a new render context. This is typically used when going through a portal. Note that you should remember the old render context if you want to restore it later. The render context will get all the values from the current context (with SCF references properly incremented).

Specified by:
createRenderContext in interface iRenderView
See Also:
iRenderView.createRenderContext()

deleteRenderContextData

public void deleteRenderContextData(iPointer key)
Description copied from interface: iRenderView
Delete all data with the given key on the current render context.

Specified by:
deleteRenderContextData in interface iRenderView
Parameters:
key -
See Also:
iRenderView.deleteRenderContextData(crystalspace.jbind.interfaces.iPointer)

findRenderContextData

public iBase findRenderContextData(iPointer key)
Description copied from interface: iRenderView
Look for data on the current render context.

Specified by:
findRenderContextData in interface iRenderView
Parameters:
key -
Returns:
See Also:
iRenderView.findRenderContextData(crystalspace.jbind.interfaces.iPointer)

getCamera

public iCamera getCamera()
Description copied from interface: iRenderView
Get the current camerapublic

Specified by:
getCamera in interface iRenderView
Returns:
See Also:
iRenderView.getCamera()

getClipper

public iClipper2D getClipper()
Description copied from interface: iRenderView
Get the 2D clipper for this view

Specified by:
getClipper in interface iRenderView
Returns:
See Also:
iRenderView.getClipper()

getClipPlane

public csPlane3 getClipPlane()
Description copied from interface: iRenderView
Get the clip plane

Specified by:
getClipPlane in interface iRenderView
Returns:
See Also:
iRenderView.getClipPlane()

getClipPlane

public boolean getClipPlane(csPlane3 pl)
Description copied from interface: iRenderView
Get the 3D clip plane that should be used to clip all geometry. If this function returns false then this plane is invalid and should not be used. Otherwise it must be used to clip the object before drawing

Specified by:
getClipPlane in interface iRenderView
Parameters:
pl -
Returns:
See Also:
iRenderView.getClipPlane(crystalspace.jbind.impl.csgeom.plane3.csPlane3)

getEngine

public iEngine getEngine()
Description copied from interface: iRenderView
Get the engine

Specified by:
getEngine in interface iRenderView
Returns:
See Also:
iRenderView.getEngine()

getFirstFogInfo

public csFogInfo getFirstFogInfo()
Description copied from interface: iRenderView
Every fogged sector we encountered results in an extra structure in the following list. This is only used if we are doing vertex based fog. This function will return the first csFogInfo instance

Specified by:
getFirstFogInfo in interface iRenderView
Returns:
See Also:
iRenderView.getFirstFogInfo()

getFrustum

public void getFrustum(float lx,
                       float rx,
                       float ty,
                       float by)
Description copied from interface: iRenderView
Get the frustum

Specified by:
getFrustum in interface iRenderView
Parameters:
lx -
rx -
ty -
by -
See Also:
iRenderView.getFrustum(float, float, float, float)

getGraphics2D

public iGraphics2D getGraphics2D()
Description copied from interface: iRenderView
Get the 2D graphics subsystem

Specified by:
getGraphics2D in interface iRenderView
Returns:
See Also:
iRenderView.getGraphics2D()

getGraphics3D

public iGraphics3D getGraphics3D()
Description copied from interface: iRenderView
Get the 3D graphics subsystem

Specified by:
getGraphics3D in interface iRenderView
Returns:
See Also:
iRenderView.getGraphics3D()

getLastPortal

public iPortal getLastPortal()
Description copied from interface: iRenderView
Get the portal we last traversed through

Specified by:
getLastPortal in interface iRenderView
Returns:
See Also:
iRenderView.getLastPortal()

getOriginalCamera

public iCamera getOriginalCamera()
Description copied from interface: iRenderView
Get the original camera for this render view. This is the camera before any space warping portals

Specified by:
getOriginalCamera in interface iRenderView
Returns:
See Also:
iRenderView.getOriginalCamera()

getPreviousSector

public iSector getPreviousSector()
Description copied from interface: iRenderView
Get previous sector

Specified by:
getPreviousSector in interface iRenderView
Returns:
See Also:
iRenderView.getPreviousSector()

getRenderContext

public csRenderContext getRenderContext()
Description copied from interface: iRenderView
Get the current render context

Specified by:
getRenderContext in interface iRenderView
Returns:
See Also:
iRenderView.getRenderContext()

getRenderRecursionLevel

public int getRenderRecursionLevel()
Description copied from interface: iRenderView
Get render recursion level

Specified by:
getRenderRecursionLevel in interface iRenderView
Returns:
See Also:
iRenderView.getRenderRecursionLevel()

getThisSector

public iSector getThisSector()
Description copied from interface: iRenderView
Get current sector

Specified by:
getThisSector in interface iRenderView
Returns:
See Also:
iRenderView.getThisSector()

getTopFrustum

public csRenderContextFrustum getTopFrustum()
Description copied from interface: iRenderView
Get the top level frustum(corresponding with SetFrustum())

Specified by:
getTopFrustum in interface iRenderView
Returns:
See Also:
iRenderView.getTopFrustum()

isClipperRequired

public boolean isClipperRequired()
Description copied from interface: iRenderView
If true then we have to clip all objects to the portal frustum (returned with GetClipper()). Normally this is not needed but some portals require this. If GetClipPlane(); returns true then the value of this function is also implied to be true.

Specified by:
isClipperRequired in interface iRenderView
Returns:
See Also:
iRenderView.isClipperRequired()

resetFogInfo

public void resetFogInfo()
Description copied from interface: iRenderView
Reset fog info

Specified by:
resetFogInfo in interface iRenderView
See Also:
iRenderView.resetFogInfo()

restoreRenderContext

public void restoreRenderContext(csRenderContext original)
Description copied from interface: iRenderView
Restore a render context. Use this to restore a previously overwritten render context. This function will take care of properly cleaning up the current render context.

Specified by:
restoreRenderContext in interface iRenderView
Parameters:
original -
See Also:
iRenderView.restoreRenderContext(crystalspace.jbind.impl.engine.rview.csRenderContext)

setClipper

public void setClipper(iClipper2D clip)
Description copied from interface: iRenderView
Set the 2D clipper for this view

Specified by:
setClipper in interface iRenderView
Parameters:
clip -
See Also:
iRenderView.setClipper(crystalspace.jbind.interfaces.igeom.clip2d.iClipper2D)

setClipPlane

public void setClipPlane(csPlane3 pl)
Description copied from interface: iRenderView
Set the 3D clip plane that should be used to clip all geometry

Specified by:
setClipPlane in interface iRenderView
Parameters:
pl -
See Also:
iRenderView.setClipPlane(crystalspace.jbind.impl.csgeom.plane3.csPlane3)

setFirstFogInfo

public void setFirstFogInfo(csFogInfo fi)
Description copied from interface: iRenderView
Set the first fog info

Specified by:
setFirstFogInfo in interface iRenderView
Parameters:
fi -
See Also:
iRenderView.setFirstFogInfo(crystalspace.jbind.impl.engine.rview.csFogInfo)

setFrustum

public void setFrustum(float lx,
                       float rx,
                       float ty,
                       float by)
Description copied from interface: iRenderView
Set the view frustum at z = 1.

Specified by:
setFrustum in interface iRenderView
Parameters:
lx -
rx -
ty -
by -
See Also:
iRenderView.setFrustum(float, float, float, float)

setLastPortal

public void setLastPortal(iPortal portal)
Description copied from interface: iRenderView
Set the last portal

Specified by:
setLastPortal in interface iRenderView
Parameters:
portal -
See Also:
iRenderView.setLastPortal(crystalspace.jbind.interfaces.iengine.portal.iPortal)

setPreviousSector

public void setPreviousSector(iSector s)
Description copied from interface: iRenderView
Set the previous sector

Specified by:
setPreviousSector in interface iRenderView
Parameters:
s -
See Also:
iRenderView.setPreviousSector(crystalspace.jbind.interfaces.iengine.sector.iSector)

setRenderRecursionLevel

public void setRenderRecursionLevel(int rec)
Description copied from interface: iRenderView
Set render recursion level

Specified by:
setRenderRecursionLevel in interface iRenderView
Parameters:
rec -
See Also:
iRenderView.setRenderRecursionLevel(int)

setThisSector

public void setThisSector(iSector s)
Description copied from interface: iRenderView
Set the current sector

Specified by:
setThisSector in interface iRenderView
Parameters:
s -
See Also:
iRenderView.setThisSector(crystalspace.jbind.interfaces.iengine.sector.iSector)

testBSphere

public boolean testBSphere(csReversibleTransform o2c,
                           csSphere sphere)
Description copied from interface: iRenderView
Test if the given bounding sphere(in object space coordinates) is visibile in this render view. The optional will transform object to camera space.

Specified by:
testBSphere in interface iRenderView
Parameters:
o2c -
sphere -
Returns:
See Also:
iRenderView.testBSphere(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.sphere.csSphere)

useClipFrustum

public void useClipFrustum(boolean u)
Description copied from interface: iRenderView
Enable the use of a clip frustum

Specified by:
useClipFrustum in interface iRenderView
Parameters:
u -
See Also:
iRenderView.useClipFrustum(boolean)

useClipPlane

public void useClipPlane(boolean u)
Description copied from interface: iRenderView
Enable the use of a clip plane

Specified by:
useClipPlane in interface iRenderView
Parameters:
u -
See Also:
iRenderView.useClipPlane(boolean)