Drag[en]gine Script Module DragonScript
1.21
|
Behavior element behavior using ECBehaviorCustomColor on ECBehaviorDynamicSkin. More...
Classes | |
class | Instance |
Behavior instance. More... | |
Public Member Functions | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
void | dispose () |
Dispose of behavior. More... | |
ECBehaviorCustomColor | getCustomColor () |
Custom color behavior. More... | |
ECBehaviorDynamicSkin | getDynamicSkin () |
Dynamic skin behavior. More... | |
ECPImage | getImage () |
Image to use. More... | |
ECPString | getRenderable () |
Name of renderable to create or empty string if not used. More... | |
ECBehaviorRenderableCanvas | getRenderableCanvas () |
Renderable canvas behavior. More... | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorDynamicSkin dynamicSkin, String renderable) |
Create behavior element class. More... | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorDynamicSkin dynamicSkin, String renderable, String id) |
Create behavior element class. More... | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorDynamicSkin dynamicSkin, String renderable, String id, String prefix) |
Create behavior element class. More... | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorRenderableCanvas renderableCanvas, String pathImage) |
Create behavior element class. More... | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorRenderableCanvas renderableCanvas, String pathImage, String id) |
Create behavior element class. More... | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorRenderableCanvas renderableCanvas, String pathImage, String id, String prefix) |
Create behavior element class. More... | |
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... | |
Protected Member Functions | |
ECBehaviorRenderableCustomColor | new (BehaviorElementClass eclass, ECBehaviorCustomColor customColor, ECBehaviorDynamicSkin dynamicSkin, String renderable, ECBehaviorRenderableCanvas renderableCanvas, String pathImage, String id, String prefix) |
Create behavior element class. More... | |
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 using ECBehaviorCustomColor on ECBehaviorDynamicSkin.
This behavior applies the chosen color of an ECBehaviorCustomColor either directly to a color type renderable or indirectly to a canvas type renderable.
Element class properties have the prefix "renderableCustomColor{(id)}.".
If no ECBehaviorRenderableCanvas is provided a color type renderable is created and the chosen collor assigned to it.
This mode of operation is best used for models using individual textures for each part to colorize. This is the fastest solution.
The following example creates an element class with two custom colors each affecting an individual skin texture:
If ECBehaviorRenderableCanvas is provided a CanvasImage is added to the canvas view. The color transform of the CanvasImage is set to the chosen color.
This mode of operation is best used for models with a single texture to colorized in a pixel-precise way. Multiple ECBehaviorCustomColor can then affect the same model texture each colorizing a precisely defined area of the texture.
The image has to be a grayscale image with optional alpha channel. Typically the image contains black-and-white pixels to enable or disable colorizing for in individual image parts but can be full grayscale to apply blending of chosen color. If the image also contains an alpha channel then the grayscale content of the image is multiplied by the color with the alpha channel defining how much the final color affects the result. Hence grayscale image without alpha channel apply flat colorization while grayscale images with alpha channel applied shaded colorization.
The order of adding ECBehaviorRenderableCustomColor to element classes is important. Behaviors added later are layered ontop of behaviors added earlier. This is especially useful for blending custom colors to get good results.
It is recommended to set the background color or image of ECBehaviorRenderableCanvas. This ensures all pixels in the texture are properly set.
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 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.
The following example creates an element class with two custom colors each applying one layer of tint to a texture with:
This behavior does not require the element class to be persistable (setPersistable).
ECBehaviorInstance Dragengine.Scenery.ECBehaviorRenderableCustomColor.createInstance | ( | BehaviorElement | element | ) |
Create Behavior instance.
Implements Dragengine.Scenery.ECBehavior.
void Dragengine.Scenery.ECBehaviorRenderableCustomColor.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECBehaviorCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.getCustomColor | ( | ) |
Custom color behavior.
ECBehaviorDynamicSkin Dragengine.Scenery.ECBehaviorRenderableCustomColor.getDynamicSkin | ( | ) |
Dynamic skin behavior.
ECPImage Dragengine.Scenery.ECBehaviorRenderableCustomColor.getImage | ( | ) |
Image to use.
ECPString Dragengine.Scenery.ECBehaviorRenderableCustomColor.getRenderable | ( | ) |
Name of renderable to create or empty string if not used.
ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCustomColor.getRenderableCanvas | ( | ) |
Renderable canvas behavior.
ECBehaviorRenderableCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCustomColor | customColor, | ||
ECBehaviorDynamicSkin | dynamicSkin, | ||
String | renderable | ||
) |
Create behavior element class.
|
protected |
Create behavior element class.
ECBehaviorRenderableCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCustomColor | customColor, | ||
ECBehaviorDynamicSkin | dynamicSkin, | ||
String | renderable, | ||
String | id | ||
) |
Create behavior element class.
ECBehaviorRenderableCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCustomColor | customColor, | ||
ECBehaviorDynamicSkin | dynamicSkin, | ||
String | renderable, | ||
String | id, | ||
String | prefix | ||
) |
Create behavior element class.
ECBehaviorRenderableCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCustomColor | customColor, | ||
ECBehaviorRenderableCanvas | renderableCanvas, | ||
String | pathImage | ||
) |
Create behavior element class.
ECBehaviorRenderableCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCustomColor | customColor, | ||
ECBehaviorRenderableCanvas | renderableCanvas, | ||
String | pathImage, | ||
String | id | ||
) |
Create behavior element class.
ECBehaviorRenderableCustomColor Dragengine.Scenery.ECBehaviorRenderableCustomColor.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCustomColor | customColor, | ||
ECBehaviorRenderableCanvas | renderableCanvas, | ||
String | pathImage, | ||
String | id, | ||
String | prefix | ||
) |
Create behavior element class.