InlineProceduralTexture.kl

Types

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[] )