InlineProceduralTexture (object)¶
バージョン 1.12.0 で追加.
The InlineProceduralTexture represents a texture which is procedurally built in KL. This is useful for noise patterns or images encoding custom data from the runtime.
/*
** Example: InlineProceduralTexture
*/
require InlineDrawing;
operator entry() {
InlineDrawing draw = OGLInlineDrawing();
// register the texture in the drawing
InlineProceduralTexture texture = draw.registerTexture(InlineProceduralTexture('customTexture'));
// update the texture later with new procedural content
Size width = 256;
Size height = 256;
Color pixels[];
pixels.resize(width * height);
for(Size i=0;i<pixels.size();i++)
pixels[i] = Color(1.0, 0.0, 0.0).linearInterpolate(Color(0.0, 1.0, 0.0), mathRandomScalar(17, i));
texture.update(width, height, pixels);
}
/*
** Output:
*/
Methods¶
InlineProceduralTexture ( in InlineProceduralTexture other ) | |
InlineProceduralTexture ( in String name ) | |
InlineProceduralTexture ( in String name, in Size width, in Size height, in Color pixels[] ) | |
InlineProceduralTexture ( in String name, in Size width, in Size height, in Float32 pixels[] ) | |
InlineProceduralTexture () | |
InlineProceduralTexture | clone ? () |
update ! ( in Size width, in Size height, in Color pixels[] ) | |
update ! ( in Size width, in Size height, in Float32 pixels[] ) |
Methods in detail¶
InlineProceduralTexture ( in InlineProceduralTexture other )
copy constructor
InlineProceduralTexture ( in String name )
standard constructor with a name only
InlineProceduralTexture ( in String name, in Size width, in Size height, in Color pixels[] )
standard constructor with a name and pixel data
InlineProceduralTexture ( in String name, in Size width, in Size height, in Float32 pixels[] )
standard constructor with a name and pixel data
standard constructor
InlineProceduralTexture InlineProceduralTexture.clone? ()
clone method
InlineProceduralTexture.update! ( in Size width, in Size height, in Color pixels[] )
updates the texture with the data provided
InlineProceduralTexture.update! ( in Size width, in Size height, in Float32 pixels[] )
updates the texture with the data provided