This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_outline [2020/05/24 01:11] – [Element Class Example] dragonlord | dragengine:modules:dragonscript:behavior_outline [2025/03/13 17:13] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
+ | |||
+ | * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] | ||
+ | * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] | ||
====== ECBehaviorOutline ====== | ====== ECBehaviorOutline ====== | ||
Line 21: | Line 24: | ||
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. | 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.*" | + | The outline skin is set by the user. To work properly it has to use the '' |
A typical outline skin looks like this: | A typical outline skin looks like this: | ||
Line 38: | Line 41: | ||
</ | </ | ||
- | By default the skin "/ | + | By default the skin '' |
- | The emissivity is optional and allows to make the outline glow in the dark. Using renderable | + | The emissivity is optional and allows to make the outline glow in the dark. Using renderable |
This set up allows to add an outline skin to any [[behavior_component|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 set up allows to add an outline skin to any [[behavior_component|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. | ||
Line 50: | Line 53: | ||
====== Instance Counts ====== | ====== Instance Counts ====== | ||
- | 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. | + | 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. |
- | < | + | |
- | class MyElement extends BehaviorElementClass | + | |
- | public var ECBehaviorComponent component | + | |
- | public var ECBehaviorCollider collider | + | |
- | + | ||
- | public func new() | + | |
- | component = ECBehaviorComponent.new(this) | + | |
- | collider = ECBehaviorCollider.new(this, | + | |
- | ECBehaviorOutline.new(this, | + | |
- | ECBehaviorOutline.new(this, | + | |
- | end | + | |
- | end | + | |
- | </ | + | |
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix | + | Element class properties have the prefix |
===== skin ===== | ===== skin ===== | ||
Path to skin to use to render the outline. | Path to skin to use to render the outline. | ||
- | * Full name: "outline{(id)}.skin" | + | * Full name: '' |
- | * Type ECPSkin | + | * Type: string |
- | * Default Value "/ | + | * Default Value: '' |
+ | * File Pattern: '' | ||
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== model ===== | ===== model ===== | ||
Path to model to use instead of the model of the dependency component | Path to model to use instead of the model of the dependency component | ||
- | * Full name: "outline{(id)}.model" | + | * Full name: '' |
- | * Type ECPModel | + | * Type: string |
- | * Default value //null// | + | * Default value: '' |
+ | * FIle Pattern: '' | ||
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== rig ===== | ===== rig ===== | ||
Path to rig to use instead of the rig of the dependency component. If null uses the dependency component rig. | Path to rig to use instead of the rig of the dependency component. If null uses the dependency component rig. | ||
- | * Full name: "outline{(id)}.rig" | + | * Full name: '' |
- | * Type ECPRig | + | * Type: String |
- | * Default value //null// | + | * Default value: '' |
+ | * File Pattern: '' | ||
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== color ===== | ===== color ===== | ||
- | Color of the outline. For this property to have any effect the used skin requires to have a renderable named "color". | + | Color of the outline. For this property to have any effect the used skin requires to have a renderable named '' |
- | * Full name: "outline{(id)}.color" | + | * Full name: '' |
- | * Type ECPColor | + | * Type: 3-component color |
- | * Default value // | + | * Default value: '' |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== intensity ===== | ===== intensity ===== | ||
- | Emissivity intensity of the outline. For this property to have any effect the used skin requires to have a renderable named "intensity". | + | Emissivity intensity of the outline. For this property to have any effect the used skin requires to have a renderable named '' |
- | * Full name: "outline{(id)}.intensity" | + | * Full name: '' |
- | * Type ECPFloat | + | * Type: floating point |
- | * Minimum Value 0 | + | * Default value: '' |
- | * Default value 0 | + | * Restriction: |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== thickness ===== | ===== thickness ===== | ||
- | Thickness of the outline. The measurement unit of this value depends on the outline type in the used skin. For this property to have any effect the used skin requires to have a renderable named "thickness". | + | Thickness of the outline. The measurement unit of this value depends on the outline type in the used skin. For this property to have any effect the used skin requires to have a renderable named '' |
- | * Full name: "outline{(id)}.thickness" | + | * Full name: '' |
- | * Type ECPFloat | + | * Type: floating point |
- | * Minimum Value 0 | + | * Default value: '' |
- | * Default value 0.005 | + | * Restrictions: |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
+ | |||
* [[behavior_component|ECBehaviorComponent]] | * [[behavior_component|ECBehaviorComponent]] | ||
* [[behavior_collider|ECBehaviorCollider]] | * [[behavior_collider|ECBehaviorCollider]] | ||
Line 119: | Line 113: | ||
====== Optional Behaviors ====== | ====== Optional Behaviors ====== | ||
- | Thie behavior does not support optional behaviors. | + | This behavior does not support optional behaviors. |
====== Persistency ====== | ====== Persistency ====== | ||
- | This behavior does support element class to be persistable (setPersistable). Saves color, intensity and visiblity state. | + | This behavior does support element class to be persistable (setPersistable). |
====== API Documentation ====== | ====== API Documentation ====== | ||
- | [[https:// | + | # |
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
+ | |||
+ | ====== Use Cases ====== | ||
+ | |||
+ | | ||
+ | | ||
====== Element Class Example ====== | ====== Element Class Example ====== | ||
Line 139: | Line 138: | ||
| | ||
- | | + | |
- | // add behaviors: component, collider | + | // add required |
| | ||
| | ||
- | | ||
- | // set parameters | + | // |
- | | + | // and has a thickness of 0.0075 using a custom |
+ | | ||
+ | | ||
| | ||
| | ||
Line 152: | Line 152: | ||
end | end | ||
</ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | < | ||
+ | <!-- optional: use component with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
+ | <string name=' | ||
+ | </ | ||
+ | | ||
+ | <!-- for adding multiple behaviors use unique identifiers --> | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Live Examples ====== | ||
+ | |||
+ | * [[https:// | ||
+ |