Drag[en]gine Script Module DragonScript
1.21
|
Behavior element behavior adding outline support to components. More...
Classes | |
class | Instance |
Behavior instance. More... | |
Public Member Functions | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
void | dispose () |
Dispose of behavior. More... | |
ECBehaviorCollider | getCollider () |
Collider behavior. More... | |
ECPColor | getColor () |
Color property. More... | |
ECBehaviorComponent | getComponent () |
Component behavior. More... | |
ECPFloat | getIntensity () |
Intensity property. More... | |
ECPModel | getModel () |
Model property. More... | |
ECPRig | getRig () |
Rig property. More... | |
ECPSkin | getSkin () |
Skin property. More... | |
ECPFloat | getThickness () |
THickness property. More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorOutline | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider) |
Create behavior element class. More... | |
ECBehaviorOutline | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, String id) |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
String | getID () |
Identifier. More... | |
int | getInstanceIndex () |
Instance index. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Static Public Member Functions | |
static Array | getAllBehaviorsIn (BehaviorElementClass eclass) |
Get list of all behaviors in element. More... | |
static Array | getAllInstancesIn (BehaviorElement element) |
Get list of all instances in element. More... | |
static ECBehaviorOutline | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
static ECBehaviorOutline | getBehaviorIn (BehaviorElementClass eclass, String id) |
Get behavior with id in element class or null if absent. More... | |
static Instance | getInstanceIn (BehaviorElement element) |
Get instance in element or null if absent. More... | |
static Instance | getInstanceIn (BehaviorElement element, String id) |
Get instance with id in element or null if absent. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
DefaultECBehavior | new (BehaviorElementClass eclass) |
Create default composeable behavior with empty identifier. More... | |
DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
Create default composeable behavior. More... | |
void | setBehaviorID (String identifier) |
Set behavior identifier. More... | |
void | useClassNameAsBehaviorID () |
Set behavior identifier to "<class-name>:<identifier>". More... | |
void | useFullyQualifiedClassNameAsBehaviorID () |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More... | |
Behavior element behavior adding outline support to components.
Renders outline around a component.
This is done by creating a new component resource. The model and rig of the existing component is assigned to the new component. The new component resource is attached to an existing collider using rig attachment mode. This makes the new component deform the same way as the existing component. The new component is thus a kind of "copy" of the existing component.
Then an outline skin is assigned to the new component and all textures it contains. This replaces every texture in the new component with the outline skin.
The outline skin is set by the user. To work properly it has to use the "outline.*" skin texture properties to render the outline and "solidity" with value "0" to hide everything but the outline. A typical outline skin looks like this:
By default the skin "/shareddata/materials/outlined.deskin" is used which is provided by the shared DragonScript Module data and provides tintable and emissive outlines.
The emissivity is optional and allows to make the outline glow in the dark. Using renderable "color" is also optional but recommended. This allows this behavior to change the outline color using a dynamic skin.
This set up allows to add an outline skin to any ECBehaviorComponent without the need to create skins with built-in support for outline rendering. If you want to use outline for all objects by default better build it into their skins which is faster.
This behavior can be also used to add outer skins in general to an ECBehaviorComponent. You have to adjust the outline skin to achieve the desired result.
This is an effect type behavior and starts out invisible. Use setVisible() to switch the outline on and off. Typically this is done in response to game events or by other behaviors managing outline parameters.
Multiple instances of ECBehaviorOutline can be used for example to create different outlines to switch on and off or to add multiple outline skins to a single ECBehaviorComponent. Keep in mind though that each instance of ECBehaviorOutline creates a new component and dynamic skin resource which can impact performance if the used model has high polygon count. To use multiple instances use code like this in your subclass constructor:
Element class properties have the prefix "outline{(id)}.".
This behavior does support element class to be persistable (setPersistable). Saves color, intensity and visiblity state.
ECBehaviorInstance Dragengine.Scenery.ECBehaviorOutline.createInstance | ( | BehaviorElement | element | ) |
Create Behavior instance.
Implements Dragengine.Scenery.ECBehavior.
void Dragengine.Scenery.ECBehaviorOutline.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
|
static |
Get list of all behaviors in element.
Returns list contains ECBehaviorOutline behaviors in the order they have been created in the element.
|
static |
Get list of all instances in element.
Returns list contains ECBehaviorOutline.Instance instances in the order they have been created in the element.
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorCollider.
|
static |
Get behavior with id in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorOutline with specific identifier.
ECBehaviorCollider Dragengine.Scenery.ECBehaviorOutline.getCollider | ( | ) |
Collider behavior.
ECPColor Dragengine.Scenery.ECBehaviorOutline.getColor | ( | ) |
Color property.
ECBehaviorComponent Dragengine.Scenery.ECBehaviorOutline.getComponent | ( | ) |
Component behavior.
|
static |
Get instance in element or null if absent.
Use this method to check if a particular BehaviorElement contains a behavior instance of type ECBehaviorOutline.Instance . If more than one instance is present returns the first instance.
|
static |
Get instance with id in element or null if absent.
Use this method to check if a particular BehaviorElement contains a behavior instance of type ECBehaviorOutline.Instance with specific identifier.
ECPFloat Dragengine.Scenery.ECBehaviorOutline.getIntensity | ( | ) |
Intensity property.
ECPFloat Dragengine.Scenery.ECBehaviorOutline.getThickness | ( | ) |
THickness property.
Instance Dragengine.Scenery.ECBehaviorOutline.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorOutline Dragengine.Scenery.ECBehaviorOutline.new | ( | BehaviorElementClass | eclass, |
ECBehaviorComponent | component, | ||
ECBehaviorCollider | collider | ||
) |
Create behavior element class.
ECBehaviorOutline Dragengine.Scenery.ECBehaviorOutline.new | ( | BehaviorElementClass | eclass, |
ECBehaviorComponent | component, | ||
ECBehaviorCollider | collider, | ||
String | id | ||
) |