Package WildMagic.LibGraphics.SceneGraph
Class IndexBuffer
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.SceneGraph.Spatial
-
- WildMagic.LibGraphics.Rendering.Bindable
-
- WildMagic.LibGraphics.SceneGraph.IndexBuffer
-
- All Implemented Interfaces:
java.io.Serializable
,NameIdInterface
,StreamInterface
public class IndexBuffer extends Bindable implements StreamInterface, java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class WildMagic.LibGraphics.Rendering.Bindable
Bindable.Info
-
Nested classes/interfaces inherited from class WildMagic.LibGraphics.SceneGraph.Spatial
Spatial.CullingMode
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
m_aiIndex
Index data array.private boolean
m_bDataChanged
protected int
m_iIQuantity
Number of int elements.protected int
m_iOffset
Index offset.private java.nio.IntBuffer
m_kIBufferData
private static long
serialVersionUID
-
Fields inherited from class WildMagic.LibGraphics.Rendering.Bindable
m_bShared, m_kInfoArray
-
Fields inherited from class WildMagic.LibGraphics.SceneGraph.Spatial
Culling, Local, m_iStartEffect, m_kEffects, m_kGlobalStates, m_kLights, m_pkParent, World, WorldBound, WorldBoundIsCurrent, WorldIsCurrent
-
-
Constructor Summary
Constructors Constructor Description IndexBuffer()
streaming supportIndexBuffer(int iIQuantity)
Create an IndexBuffer with the input number of indices.IndexBuffer(int[] aiIndex)
Create an IndexBuffer with the connectivity array.IndexBuffer(int[] aiIndex, int iSize)
IndexBuffer(int iIQuantity, int[] aiIndex)
Create an IndexBuffer with the input number of indices and connectivity array.IndexBuffer(IndexBuffer pkIBuffer)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
DataChanged(boolean bChanged)
void
dispose()
Delete memory.java.nio.IntBuffer
GetBufferData()
int[]
GetData()
Direct access to the index buffer data.int
GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.int
GetIndexQuantity()
Direct access to the index buffer data.int
GetOffset()
The offset into the indices is used by the renderer for drawing.boolean
IsDataChanged()
void
Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.void
Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.private void
readObject(java.io.ObjectInputStream in)
boolean
Register(Stream rkStream)
Registers this object with the input Stream parameter.void
Save(Stream rkStream)
Write this object and all it's children to the Stream.StringTree
SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.void
SetIndexQuantity(int iIQuantity)
An application might want to vary the "active quantity" of indices.void
SetOffset(int iOffset)
The offset into the indices is used by the renderer for drawing.private void
writeObject(java.io.ObjectOutputStream out)
-
Methods inherited from class WildMagic.LibGraphics.Rendering.Bindable
GetIdentifier, GetIdentifier, GetInfoQuantity, GetShared, GetVisibleSet, IsReload, IsReload, OnLoad, OnRelease, Release, Reload, Reload, Remove, SetShared, UpdateState, UpdateWorldBound
-
Methods inherited from class WildMagic.LibGraphics.SceneGraph.Spatial
AttachEffect, AttachGlobalState, AttachLight, DetachAllEffects, DetachAllGlobalStates, DetachAllLights, DetachEffect, DetachGlobalState, DetachLight, GetAllObjectsByName, GetEffect, GetEffectQuantity, GetGlobalState, GetGlobalState, GetGlobalStateQuantity, GetLight, GetLightQuantity, GetObjectByID, GetObjectByName, GetParent, GetStartEffect, OnGetVisibleSet, PopState, PropagateBoundToRoot, PropagateStateFromRoot, PushState, SetParent, SetStartEffect, UpdateBS, UpdateGS, UpdateGS, UpdateRS, UpdateRS, UpdateWorldData
-
Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_iIQuantity
protected int m_iIQuantity
Number of int elements.
-
m_aiIndex
protected int[] m_aiIndex
Index data array.
-
m_kIBufferData
private java.nio.IntBuffer m_kIBufferData
-
m_iOffset
protected int m_iOffset
Index offset.
-
m_bDataChanged
private boolean m_bDataChanged
-
-
Constructor Detail
-
IndexBuffer
public IndexBuffer()
streaming support
-
IndexBuffer
public IndexBuffer(IndexBuffer pkIBuffer)
Copy constructor.- Parameters:
pkIBuffer
- the IndexBuffer to copy into this.
-
IndexBuffer
public IndexBuffer(int iIQuantity)
Create an IndexBuffer with the input number of indices.- Parameters:
iIQuantity
- the number of int elements.
-
IndexBuffer
public IndexBuffer(int iIQuantity, int[] aiIndex)
Create an IndexBuffer with the input number of indices and connectivity array.- Parameters:
iIQuantity
- the number of int elements.aiIndex
- connectivity array.
-
IndexBuffer
public IndexBuffer(int[] aiIndex)
Create an IndexBuffer with the connectivity array.- Parameters:
aiIndex
- connectivity array.
-
IndexBuffer
public IndexBuffer(int[] aiIndex, int iSize)
-
-
Method Detail
-
GetData
public final int[] GetData()
Direct access to the index buffer data. The quantity is the number of int elements. The number of bytes for the entire index buffer is GetIndexQuantity()*sizeof(int).- Returns:
- index data array.
-
GetBufferData
public final java.nio.IntBuffer GetBufferData()
-
GetDiskUsed
public int GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.- Specified by:
GetDiskUsed
in interfaceStreamInterface
- Overrides:
GetDiskUsed
in classSpatial
- Parameters:
rkVersion
- the current version of the Stream file being created.- Returns:
- the size of this object on disk.
-
GetIndexQuantity
public final int GetIndexQuantity()
Direct access to the index buffer data. The quantity is the number of int elements. The number of bytes for the entire index buffer is GetIndexQuantity()*sizeof(int).- Returns:
- number of int elements.
-
GetOffset
public final int GetOffset()
The offset into the indices is used by the renderer for drawing. The ability to set this is useful when multiple geometric primitives share an index buffer, each primitive using a continguous set of indices. In this case, SetIndexQuantity and SetOffset will be called dynamically during the application for each such geometric primitive.- Returns:
- index offset.
-
IsDataChanged
public boolean IsDataChanged()
-
DataChanged
public void DataChanged(boolean bChanged)
-
Link
public void Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.- Specified by:
Link
in interfaceStreamInterface
- Overrides:
Link
in classSpatial
- Parameters:
rkStream
- the Stream where the child objects are stored.pkLink
- the Link class from which the child object IDs are read.
-
Load
public void Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.- Specified by:
Load
in interfaceStreamInterface
- Overrides:
Load
in classSpatial
- Parameters:
rkStream
- the Stream from which this object is being read.pkLink
- the Link class for storing the IDs of this object's children objects.
-
Register
public boolean Register(Stream rkStream)
Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.- Specified by:
Register
in interfaceStreamInterface
- Overrides:
Register
in classSpatial
- Parameters:
rkStream
- the Stream where the child objects are stored.- Returns:
- true if this object is registered, false if the object has already been registered.
-
Save
public void Save(Stream rkStream)
Write this object and all it's children to the Stream.- Specified by:
Save
in interfaceStreamInterface
- Overrides:
Save
in classSpatial
- Parameters:
rkStream
- the Stream where the child objects are stored.
-
SaveStrings
public StringTree SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.- Specified by:
SaveStrings
in interfaceStreamInterface
- Overrides:
SaveStrings
in classSpatial
- Parameters:
acTitle
- the header for this object in the StringTree.- Returns:
- StringTree containing a String-based representation of this object and it's children.
-
SetIndexQuantity
public final void SetIndexQuantity(int iIQuantity)
An application might want to vary the "active quantity" of indices. Use this function to do so. It does not change the data storage, only the m_iQuantity member. The caller is responsible for saving the full quantity of indices and resetting this when finished with the index buffer. The caller also should not pass in a quantity that is larger than the original full quantity.- Parameters:
iIQuantity
- number of int elements.
-
SetOffset
public void SetOffset(int iOffset)
The offset into the indices is used by the renderer for drawing. The ability to set this is useful when multiple geometric primitives share an index buffer, each primitive using a continguous set of indices. In this case, SetIndexQuantity and SetOffset will be called dynamically during the application for each such geometric primitive.- Parameters:
iOffset
- index offset.
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-