Drag[en]gine Script Module DragonScript  1.21
Dragengine.Scenery.ECBehaviorOutline Class Reference

Behavior element behavior adding outline support to components. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorOutline:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

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...
 

Detailed Description

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:

<?xml version='1.0' encoding='UTF-8'?>
<skin>
<texture name='material'>
<value property='solidity'>0</value>
<color property='outline.color' r='0' g='0' b='0' a='1' renderable='color'/>
<value property='outline.thickness' renderable='thickness'>0.005</value>
<value property='outline.thickness.screen'>1</value>
<color property='outline.emissivity' r='0' g='0' b='0' a='1' renderable='color'/>
<value property='outline.emissivity.intensity' renderable='intensity'>4</value>
</texture>
</skin>

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:

class MyElement extends BehaviorElementClass
public var ECBehaviorComponent component
public var ECBehaviorCollider collider
public func new()
component = ECBehaviorComponent.new(this)
collider = ECBehaviorCollider.new(this, component)
ECBehaviorOutline.new(this, component, collider)
ECBehaviorOutline.new(this, component, collider, "secondOutline")
end
end
ECBehaviorOutline new(BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider)
Create behavior element class.

Element class properties have the prefix "outline{(id)}.".

This behavior does support element class to be persistable (setPersistable). Saves color, intensity and visiblity state.

Member Function Documentation

◆ createInstance()

ECBehaviorInstance Dragengine.Scenery.ECBehaviorOutline.createInstance ( BehaviorElement  element)

Create Behavior instance.

Implements Dragengine.Scenery.ECBehavior.

◆ dispose()

void Dragengine.Scenery.ECBehaviorOutline.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getAllBehaviorsIn()

static Array Dragengine.Scenery.ECBehaviorOutline.getAllBehaviorsIn ( BehaviorElementClass  eclass)
static

Get list of all behaviors in element.

Returns list contains ECBehaviorOutline behaviors in the order they have been created in the element.

◆ getAllInstancesIn()

static Array Dragengine.Scenery.ECBehaviorOutline.getAllInstancesIn ( BehaviorElement  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.

◆ getBehaviorIn() [1/2]

static ECBehaviorOutline Dragengine.Scenery.ECBehaviorOutline.getBehaviorIn ( BehaviorElementClass  eclass)
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.

◆ getBehaviorIn() [2/2]

static ECBehaviorOutline Dragengine.Scenery.ECBehaviorOutline.getBehaviorIn ( BehaviorElementClass  eclass,
String  id 
)
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.

◆ getCollider()

ECBehaviorCollider Dragengine.Scenery.ECBehaviorOutline.getCollider ( )

Collider behavior.

◆ getColor()

ECPColor Dragengine.Scenery.ECBehaviorOutline.getColor ( )

Color property.

◆ getComponent()

ECBehaviorComponent Dragengine.Scenery.ECBehaviorOutline.getComponent ( )

Component behavior.

◆ getInstanceIn() [1/2]

static Instance Dragengine.Scenery.ECBehaviorOutline.getInstanceIn ( BehaviorElement  element)
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.

◆ getInstanceIn() [2/2]

static Instance Dragengine.Scenery.ECBehaviorOutline.getInstanceIn ( BehaviorElement  element,
String  id 
)
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.

◆ getIntensity()

ECPFloat Dragengine.Scenery.ECBehaviorOutline.getIntensity ( )

Intensity property.

◆ getModel()

ECPModel Dragengine.Scenery.ECBehaviorOutline.getModel ( )

Model property.

◆ getRig()

ECPRig Dragengine.Scenery.ECBehaviorOutline.getRig ( )

Rig property.

◆ getSkin()

ECPSkin Dragengine.Scenery.ECBehaviorOutline.getSkin ( )

Skin property.

◆ getThickness()

ECPFloat Dragengine.Scenery.ECBehaviorOutline.getThickness ( )

THickness property.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorOutline.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/2]

ECBehaviorOutline Dragengine.Scenery.ECBehaviorOutline.new ( BehaviorElementClass  eclass,
ECBehaviorComponent  component,
ECBehaviorCollider  collider 
)

Create behavior element class.

◆ new() [2/2]

ECBehaviorOutline Dragengine.Scenery.ECBehaviorOutline.new ( BehaviorElementClass  eclass,
ECBehaviorComponent  component,
ECBehaviorCollider  collider,
String  id 
)

The documentation for this class was generated from the following file: