getVarys method

  1. @override
dynamic getVarys(
  1. dynamic shaderStage
)
override

Implementation

@override
getVarys(shaderStage) {
  var snippets = [];

  if (shaderStage == 'vertex') {
    snippets.add( '@builtin( position ) Vertex: vec4<f32>' );

    var varys = this.varys;

    for (var index = 0; index < varys.length; index++) {
      var vary = varys[index];

      snippets.add( " @location( ${index} ) ${ vary.name } : ${ this.getType( vary.type ) }" );
    }
  } else if (shaderStage == 'fragment') {
    var varys = this.varys;

    for (var index = 0; index < varys.length; index++) {
      var vary = varys[index];

      snippets.add( "@location( ${index} ) ${ vary.name } : ${ this.getType( vary.type ) }" );
    }
  }

  var code = snippets.join( ',\n\t' );

		return shaderStage == 'vertex' ? this._getWGSLStruct( 'NodeVarysStruct', code ) : code;
}