org.ogre4j
Class PatchSurface

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.PatchSurface
All Implemented Interfaces:
IAllocatedObject<IGeometryAllocPolicy>, IGeometryAllocatedObject, IPatchSurface, INativeObject

public class PatchSurface
extends NativeObject
implements IPatchSurface


Nested Class Summary
static class PatchSurface.PatchSurfaceType
           
static class PatchSurface.VisibleSide
           
 
Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  PatchSurface()
           
  PatchSurface(InstancePointer p)
          This constructor is public for internal useage only!
protected PatchSurface(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  PatchSurface(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
 void build(IHardwareVertexBufferSharedPtr destVertexBuffer, int vertexStart, IHardwareIndexBufferSharedPtr destIndexBuffer, int indexStart)
          Tells the system to build the mesh relating to the surface into externally created buffers.
 void defineSurface(VoidPointer controlPointBuffer, IVertexDeclaration declaration, int width, int height, PatchSurface.PatchSurfaceType pType, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, PatchSurface.VisibleSide visibleSide)
          Sets up the surface by defining it's control points, type and initial subdivision level.
 void delete()
          Deletes the corresponding C++ object.
 void finalize()
           
 float getBoundingSphereRadius()
          Gets the radius of the bounding sphere for this patch, only valid after defineSurface has been called.
 IAxisAlignedBox getBounds()
          Gets the bounds of this patch, only valid after calling defineSurface.
 VoidPointer getControlPointBuffer()
           
 int getCurrentIndexCount()
          Gets the current index count based on the current subdivision level.
 int getIndexOffset()
           
 int getRequiredIndexCount()
          Based on a previous call to defineSurface, establishes the number of indexes required to hold this patch at the maximum detail level.
 int getRequiredVertexCount()
          Based on a previous call to defineSurface, establishes the number of vertices required to hold this patch at the maximum detail level.
 float getSubdivisionFactor()
          Gets the current level of subdivision.
 int getVertexOffset()
           
 void notifyControlPointBufferDeallocated()
          Convenience method for telling the patch that the control points have been deleted, since once the patch has been built they are not required.
 void setSubdivisionFactor(float factor)
          Alters the level of subdivision for this surface.
 
Methods inherited from class org.xbig.base.NativeObject
disconnectFromNativeObject, equals, getInstancePointer, hashCode, setInstancePointer, setInstancePointer, setInstancePointer, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xbig.base.INativeObject
disconnectFromNativeObject, getInstancePointer, setInstancePointer, setInstancePointer, setInstancePointer
 

Constructor Detail

PatchSurface

public PatchSurface(InstancePointer p)
This constructor is public for internal useage only! Do not use it!


PatchSurface

protected PatchSurface(InstancePointer p,
                       boolean remote)
Creates a Java wrapper object for an existing C++ object. If remote is set to 'true' this object cannot be deleted in Java.


PatchSurface

public PatchSurface(WithoutNativeObject val)
Allows creation of Java objects without C++ objects.

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()

PatchSurface

public PatchSurface()
Method Detail

delete

public void delete()
Description copied from interface: INativeObject
Deletes the corresponding C++ object.

Subclasses must implement this but if the native instance was created by the underlying library the native call to dispose must not happen!

Specified by:
delete in interface INativeObject
Specified by:
delete in class NativeObject
See Also:
#remote

finalize

public void finalize()
Overrides:
finalize in class NativeObject

defineSurface

public void defineSurface(VoidPointer controlPointBuffer,
                          IVertexDeclaration declaration,
                          int width,
                          int height,
                          PatchSurface.PatchSurfaceType pType,
                          int uMaxSubdivisionLevel,
                          int vMaxSubdivisionLevel,
                          PatchSurface.VisibleSide visibleSide)
Sets up the surface by defining it's control points, type and initial subdivision level.

Specified by:
defineSurface in interface IPatchSurface

getRequiredVertexCount

public int getRequiredVertexCount()
Based on a previous call to defineSurface, establishes the number of vertices required to hold this patch at the maximum detail level.

Specified by:
getRequiredVertexCount in interface IPatchSurface

getRequiredIndexCount

public int getRequiredIndexCount()
Based on a previous call to defineSurface, establishes the number of indexes required to hold this patch at the maximum detail level.

Specified by:
getRequiredIndexCount in interface IPatchSurface

getCurrentIndexCount

public int getCurrentIndexCount()
Gets the current index count based on the current subdivision level.

Specified by:
getCurrentIndexCount in interface IPatchSurface

getIndexOffset

public int getIndexOffset()
Specified by:
getIndexOffset in interface IPatchSurface

getVertexOffset

public int getVertexOffset()
Specified by:
getVertexOffset in interface IPatchSurface

getBounds

public IAxisAlignedBox getBounds()
Gets the bounds of this patch, only valid after calling defineSurface.

Specified by:
getBounds in interface IPatchSurface

getBoundingSphereRadius

public float getBoundingSphereRadius()
Gets the radius of the bounding sphere for this patch, only valid after defineSurface has been called.

Specified by:
getBoundingSphereRadius in interface IPatchSurface

build

public void build(IHardwareVertexBufferSharedPtr destVertexBuffer,
                  int vertexStart,
                  IHardwareIndexBufferSharedPtr destIndexBuffer,
                  int indexStart)
Tells the system to build the mesh relating to the surface into externally created buffers.

Specified by:
build in interface IPatchSurface

setSubdivisionFactor

public void setSubdivisionFactor(float factor)
Alters the level of subdivision for this surface.

Specified by:
setSubdivisionFactor in interface IPatchSurface

getSubdivisionFactor

public float getSubdivisionFactor()
Gets the current level of subdivision.

Specified by:
getSubdivisionFactor in interface IPatchSurface

getControlPointBuffer

public VoidPointer getControlPointBuffer()
Specified by:
getControlPointBuffer in interface IPatchSurface

notifyControlPointBufferDeallocated

public void notifyControlPointBufferDeallocated()
Convenience method for telling the patch that the control points have been deleted, since once the patch has been built they are not required.

Specified by:
notifyControlPointBufferDeallocated in interface IPatchSurface


Copyright © 2007 netAllied GmbH. All Rights Reserved.