public class RenderShape extends java.lang.Object implements IShape
Stores additional information for generating a JME3 spatial and material from the IShape
iComponentVisitor
iComponentListener
Constructor and Description |
---|
RenderShape(IShape shape) |
Modifier and Type | Method and Description |
---|---|
void |
accept(IComponentVisitor visitor)
This operation directs the Component to call back to an IComponentVisitor
so that the visitor can perform its required actions for the exact type
of the Component.
|
void |
acceptShapeVisitor(IShapeVisitor visitor)
Calls back onto the visitor's visit() operation, revealing the concrete
type of the IShape
|
java.lang.Object |
clone()
This operation returns a clone of the Identifiable instance using a deep
copy.
|
com.jme3.material.Material |
createMaterial()
Generates the material from the current shape state
|
com.jme3.scene.Spatial |
createSpatial()
Generates a Spatial object from the current shape state
The proper material is automatically assigned to the Spatial when
created.
|
boolean |
equals(java.lang.Object otherObject)
This operation is used to check equality between the ICE and another
Identifiable entity.
|
float |
getAlpha()
Returns the alpha value, scaled on [0, 1]
|
java.lang.String |
getDescription()
This operation retrieves the description of the Identifiable entity.
|
int |
getId()
This operation retrieves the identification number of the Identifiable
entity.
|
java.lang.String |
getName()
This operation retrieves the name of the Identifiable entity.
|
IShape |
getParent()
Returns the parent associated with this shape, or null if the shape does
not have a parent
|
java.lang.String |
getProperty(java.lang.String key)
Returns the value associated with the property key
|
Transformation |
getTransformation()
Returns a copy of the transformation matrix associated with this shape
node
|
int |
hashCode()
This operation returns the hashcode value of the Identifiable entity.
|
boolean |
isSelected()
Returns the selected state of the shape
|
void |
register(IUpdateableListener listener)
This operation registers a listener that realizes the IUpdateableListener
interface with the IUpdateable so that it can receive notifications of
changes to the IUpdateable if they are published.
|
boolean |
removeProperty(java.lang.String key)
Removes the value associated with the key in the properties list
|
void |
setAlpha(float alpha)
Sets the alpha amount to the given value
|
void |
setDescription(java.lang.String description)
This operation sets the description of the Identifiable entity.
|
void |
setId(int id)
This operation sets the identification number of the Identifiable entity.
|
void |
setName(java.lang.String name)
This operation sets the name of the Identifiable entity.
|
boolean |
setProperty(java.lang.String key,
java.lang.String value)
Sets the property value associated with the key string
|
void |
setSelected(boolean selected)
Sets the selected state of the shape
|
boolean |
setTransformation(Transformation transformation)
Replaces the transformation matrix with a copy of the given Matrix4x4
|
void |
unregister(IUpdateableListener listener)
This operation unregisters a listener that realizes the
IUpdateableListener interface with the IUpdateable so that it will no
longer receive notifications of changes to the IUpdateable if they are
published.
|
void |
update(java.lang.String updatedKey,
java.lang.String newValue)
This operation notifies a class that has implemented IUpdateable that the
value associated with the particular key has been updated.
|
public RenderShape(IShape shape)
shape
- public boolean isSelected()
Returns the selected state of the shape
The selected state
public void setSelected(boolean selected)
Sets the selected state of the shape
selected
- The selected state
public com.jme3.material.Material createMaterial()
Generates the material from the current shape state
In order to obtain a Spacial object, assigning it a material from this operation is not needed. It is automatically assigned a material in this implementation.
The new material
public com.jme3.scene.Spatial createSpatial()
public void setAlpha(float alpha)
Sets the alpha amount to the given value
alpha
- The new alpha value (0 is transparent, 1 is opaque)
public float getAlpha()
Returns the alpha value, scaled on [0, 1]
The alpha value (0 is transparent, 1 is opaque)
public void setId(int id)
Identifiable
This operation sets the identification number of the Identifiable entity. It must be greater than zero.
setId
in interface Identifiable
id
- The unique identification number that should be assigned to the Identifiable entity.
public java.lang.String getDescription()
Identifiable
This operation retrieves the description of the Identifiable entity.
getDescription
in interface Identifiable
The description of the Identifiable entity.
public int getId()
Identifiable
This operation retrieves the identification number of the Identifiable entity.
getId
in interface Identifiable
The unique identification number of the Identifiable entity.
public void setName(java.lang.String name)
Identifiable
This operation sets the name of the Identifiable entity.
setName
in interface Identifiable
name
- The name that should be given to the Identifiable entity.
public java.lang.String getName()
Identifiable
This operation retrieves the name of the Identifiable entity.
getName
in interface Identifiable
The name of the Identifiable entity.
public void setDescription(java.lang.String description)
Identifiable
This operation sets the description of the Identifiable entity.
setDescription
in interface Identifiable
description
- The description that should be stored for the Identifiable entity.
public boolean equals(java.lang.Object otherObject)
Identifiable
This operation is used to check equality between the ICE and another Identifiable entity. It returns true if the Identifiable entities are equal and false if they are not.
equals
in interface Identifiable
equals
in class java.lang.Object
otherObject
- The other Identifiable entity that should be compared with this one.
True if the Identifiable entitys are equal, false otherwise.
public int hashCode()
Identifiable
This operation returns the hashcode value of the Identifiable entity.
hashCode
in interface Identifiable
hashCode
in class java.lang.Object
The hashcode of the Identifiable entity.
public void update(java.lang.String updatedKey, java.lang.String newValue)
IUpdateable
This operation notifies a class that has implemented IUpdateable that the value associated with the particular key has been updated.
update
in interface IUpdateable
updatedKey
- A unique key that describes the value that to be updated.
newValue
- The updated value of the key.
public void register(IUpdateableListener listener)
IUpdateable
This operation registers a listener that realizes the IUpdateableListener interface with the IUpdateable so that it can receive notifications of changes to the IUpdateable if they are published.
register
in interface IUpdateable
listener
- The new listener that should be notified when the the Component's state changes.
public void accept(IComponentVisitor visitor)
Component
This operation directs the Component to call back to an IComponentVisitor so that the visitor can perform its required actions for the exact type of the Component.
public Transformation getTransformation()
IShape
Returns a copy of the transformation matrix associated with this shape node
getTransformation
in interface IShape
The transformation matrix applied to this node in the CSG tree
public boolean setTransformation(Transformation transformation)
IShape
Replaces the transformation matrix with a copy of the given Matrix4x4
Returns whether the setting was successful
setTransformation
in interface IShape
transformation
- The transformation matrix to be applied to the shape
True if setting the transformation was successful, false otherwise
public java.lang.String getProperty(java.lang.String key)
IShape
Returns the value associated with the property key
If the key does not exist, this operation returns null.
getProperty
in interface IShape
key
- The key corresponding to the desired property value
The desired value, or null if the key does not exist
public boolean setProperty(java.lang.String key, java.lang.String value)
IShape
Sets the property value associated with the key string
If the key does not yet exist, append the key/value pair to the end of the property list. If it exists, find and replace the property value with the new one.
setProperty
in interface IShape
key
- The new or pre-existing key
value
- The new value
True if the property setting is valid, false otherwise
public boolean removeProperty(java.lang.String key)
IShape
Removes the value associated with the key in the properties list
This operation returns whether the key was found and removed.
removeProperty
in interface IShape
key
- The key associated with the value to remove
True if the value was found and removed, false otherwise
public IShape getParent()
IShape
Returns the parent associated with this shape, or null if the shape does not have a parent
public void acceptShapeVisitor(IShapeVisitor visitor)
IShape
Calls back onto the visitor's visit() operation, revealing the concrete type of the IShape
The name of this operation is changed from the typical naming conventions of the visitor pattern to avoid conflicts with the Component::accept() operation.
acceptShapeVisitor
in interface IShape
visitor
- The IShapeVisitor to call back in order to reveal the type of this IShape
public java.lang.Object clone()
Identifiable
This operation returns a clone of the Identifiable instance using a deep copy.
clone
in interface Identifiable
clone
in class java.lang.Object
The new clone.
public void unregister(IUpdateableListener listener)
IUpdateable
This operation unregisters a listener that realizes the IUpdateableListener interface with the IUpdateable so that it will no longer receive notifications of changes to the IUpdateable if they are published.
unregister
in interface IUpdateable
listener
- The listener that should no longer receive updates.