|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.scene.DistanceSwitchModel
public class DistanceSwitchModel
DistanceSwitchModel
defines a SwitchModel
for
selecting a child node based on the current distance from the containing node
to the camera. This can be used with the DiscreteLodNode
subclass of SwitchNode
to all the detail level to decrease as
the camera travels futher away from the object. The number of children to
switch between is provided and the distances are also set. So, each child
would have a minimum distance and a maximum distance. The child selected is
the one that the camera to model distance is between the a particular child's
min and max. If no values are valid, SN_INVALID_CHILD is returned.
Constructor Summary | |
---|---|
DistanceSwitchModel()
|
|
DistanceSwitchModel(int numChildren)
Constructor instantiates a new DistanceSwitchModel object
with the number of children to select from. |
Method Summary | |
---|---|
java.lang.Class |
getClassTag()
|
float |
getModelMaxDistance(int index)
Gets the maximum distance for this spatial index. |
float |
getModelMinDistance(int index)
Gets the minimum distance for this spatial index. |
int |
getNumChildren()
Returns the number of children that distances exist for. |
int |
getSwitchChild()
getSwitchChild returns the index of the child that should
be switched on. |
void |
read(JMEImporter e)
|
void |
set(java.lang.Object value)
set accepts Float and Vector3f objects to set the
properties of the distance switch model. |
void |
setModelDistance(int index,
float minDist,
float maxDist)
setModelDistance sets the minimum and maximum distance
that a particular child should be used. |
void |
setModelMaxDistance(int index,
float maxDist)
setModelMaxDistance sets the maximum distance that a
particular child should be used. |
void |
setModelMinDistance(int index,
float minDist)
setModelMinDistance sets the minimum distance that a
particular child should be used. |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DistanceSwitchModel()
public DistanceSwitchModel(int numChildren)
DistanceSwitchModel
object
with the number of children to select from.
numChildren
- the number of children this model selects from.Method Detail |
---|
public int getNumChildren()
public float getModelMinDistance(int index)
index
-
public float getModelMaxDistance(int index)
index
-
public void setModelMinDistance(int index, float minDist)
setModelMinDistance
sets the minimum distance that a
particular child should be used.
index
- the index of the child.minDist
- the minimum of this child.public void setModelMaxDistance(int index, float maxDist)
setModelMaxDistance
sets the maximum distance that a
particular child should be used.
index
- the index of the child.maxDist
- the maximum of this child.public void setModelDistance(int index, float minDist, float maxDist)
setModelDistance
sets the minimum and maximum distance
that a particular child should be used.
index
- the index of the child.minDist
- the minimum of this child.maxDist
- the maximum of this child.public void set(java.lang.Object value)
set
accepts Float and Vector3f objects to set the
properties of the distance switch model. If the value passed is a Float
object, this value is used to determine the world scale (squared) value,
which allows the adjustment of the min and max distances for switching.
If the value passed is a Vector3f, that is used to set the difference of
the switch node and a comparison point which is typically the camera
location.
set
in interface SwitchModel
value
- either Float - the world scale squared value, or Vector3f -
the difference between the switch node and a location.public int getSwitchChild()
getSwitchChild
returns the index of the child that should
be switched on. The current distance between the parent switch node and a
supplied point is used to determine the valid child.
getSwitchChild
in interface SwitchModel
public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.Class getClassTag()
getClassTag
in interface Savable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |