This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_renderablecustomcolor [2020/12/20 23:26] – [ECBehaviorRenderableCustomColor] dragonlord | dragengine:modules:dragonscript:behavior_renderablecustomcolor [2025/03/13 17:12] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 20: | Line 20: | ||
This behavior differs from using [[gamedev: | This behavior differs from using [[gamedev: | ||
- | ====== Multi Texture Mode (Using Color Type Renderable | + | See also: |
+ | * [[gamedev: | ||
+ | * [[gamedev: | ||
+ | |||
+ | ===== Multi Texture Mode (Color Type Renderable) ===== | ||
If no [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]] is provided a color type [[gamedev: | If no [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]] is provided a color type [[gamedev: | ||
Line 26: | Line 30: | ||
This mode of operation is best used for models using individual textures for each part to colorize. This is the fastest solution. | This mode of operation is best used for models using individual textures for each part to colorize. This is the fastest solution. | ||
- | ====== Single Texture Mode (Using [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]]) ===== | + | ===== Single Texture Mode (ECBehaviorRenderableCanvas) ==== |
If [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]] is provided a [[gamedev: | If [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]] is provided a [[gamedev: | ||
Line 40: | Line 44: | ||
The advantage of using this mode is that you can layer any number of custom colors onto a texture easily. | The advantage of using this mode is that you can layer any number of custom colors onto a texture easily. | ||
- | The disadvantage is that graphic modules have to render the [[gamedev: | + | The disadvantage is that graphic modules have to render the renderable from the canvas view before it can be used for rendering the component. If many elements use this kind of colorizing the GPU memory consumption can be high. Graphic modules know about this and can release dynamic texture content. Nevertheless it is good to keep this in mind. |
====== Instance Counts ====== | ====== Instance Counts ====== | ||
Line 48: | Line 52: | ||
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix | + | Element class properties have the prefix |
===== renderable ===== | ===== renderable ===== | ||
- | Name of the [[gamedev: | + | Name of the renderable in the component skin to modify. This is used for the Multi Texture Mode. Requires a [[behavior_dynamicskin|ECBehaviorDynamicSkin]] assigned to the ECBehaviorRenderableCustomColor. |
- | * Full name: "renderableCustomColor.renderable" | + | * Full name: '' |
* Type: string | * Type: string | ||
- | * Default Value: | + | * Default Value: empty string |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== image ===== | ===== image ===== | ||
Image to use for Single Texture Mode. Requires a [[behavior_renderablecanvas||ECBehaviorRenderableCanvas]] assigned to the ECBehaviorRenderableCustomColor. Image can be grayscale for flat mode or grayscale with alpha channel for colorized mode. | Image to use for Single Texture Mode. Requires a [[behavior_renderablecanvas||ECBehaviorRenderableCanvas]] assigned to the ECBehaviorRenderableCustomColor. Image can be grayscale for flat mode or grayscale with alpha channel for colorized mode. | ||
- | * Full name: "renderableCustomColor.image" | + | * Full name: '' |
- | * Type: string | + | * Type: string |
* Default value: empty string | * Default value: empty string | ||
+ | * File Pattern: '' | ||
* Example (*.deeclass): | * Example (*.deeclass): | ||
Line 76: | Line 81: | ||
====== Persistency ====== | ====== Persistency ====== | ||
- | This behavior does not use persistency. | + | This behavior does not required element class to be persistable (setPersistable). |
====== API Documentation ====== | ====== API Documentation ====== | ||
- | [[https:// | + | # |
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
====== Use Cases ====== | ====== Use Cases ====== | ||
Line 137: | Line 142: | ||
end | end | ||
end | end | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | < | ||
+ | <!-- optional: use custom color with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use renderable canvas with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use dynamic skin 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 --> | ||
+ | < | ||
+ | </ | ||
</ | </ | ||