Skip to content

Documentation / device / PBFunctionScope

Class: PBFunctionScope

Defined in: libs/device/src/builder/programbuilder.ts:3903

Scope that insides a function

Extends

Indexable

[props: string]: any

Accessors

$thisProxy

Get Signature

get $thisProxy(): T

Defined in: libs/device/src/builder/base.ts:133

Returns

T

Inherited from

PBInsideFunctionScope.$thisProxy


$builder

Get Signature

get $builder(): ProgramBuilder

Defined in: libs/device/src/builder/programbuilder.ts:2772

Get the program builder

Returns

ProgramBuilder

Inherited from

PBInsideFunctionScope.$builder


$builtins

Get Signature

get $builtins(): PBBuiltinScope

Defined in: libs/device/src/builder/programbuilder.ts:2776

Returns the scope of the builtin variables

Returns

PBBuiltinScope

Inherited from

PBInsideFunctionScope.$builtins


$inputs

Get Signature

get $inputs(): PBInputScope

Defined in: libs/device/src/builder/programbuilder.ts:2780

Returns the scope of the input variables

Returns

PBInputScope

Inherited from

PBInsideFunctionScope.$inputs


$outputs

Get Signature

get $outputs(): PBOutputScope

Defined in: libs/device/src/builder/programbuilder.ts:2784

Returns the scope of the output variables

Returns

PBOutputScope

Inherited from

PBInsideFunctionScope.$outputs


$l

Get Signature

get $l(): PBLocalScope

Defined in: libs/device/src/builder/programbuilder.ts:2812

Get the current local scope

Returns

PBLocalScope

Inherited from

PBInsideFunctionScope.$l


$g

Get Signature

get $g(): PBGlobalScope

Defined in: libs/device/src/builder/programbuilder.ts:2816

Get the global scope

Returns

PBGlobalScope

Inherited from

PBInsideFunctionScope.$g

Methods

$getVertexAttrib()

$getVertexAttrib(semantic): PBShaderExp

Defined in: libs/device/src/builder/programbuilder.ts:2808

Get the input vertex attribute by specified semantic

Parameters

semantic

VertexSemantic

The vertex semantic

Returns

PBShaderExp

The input vertex attribute or null if not exists

Remarks

Can only be called only in vertex shader

Inherited from

PBInsideFunctionScope.$getVertexAttrib


$query()

$query(name): PBShaderExp

Defined in: libs/device/src/builder/programbuilder.ts:2834

Query the global variable by the name

Parameters

name

string

Name of the variable

Returns

PBShaderExp

The variable or null if not exists

Inherited from

PBInsideFunctionScope.$query


$return()

$return(retval?): void

Defined in: libs/device/src/builder/programbuilder.ts:3689

Creates a 'return' statement

Parameters

retval?

ExpValueType

The return value

Returns

void

Inherited from

PBInsideFunctionScope.$return


$scope()

$scope(body): PBInsideFunctionScope

Defined in: libs/device/src/builder/programbuilder.ts:3760

Creates a new scope

Parameters

body

(this) => void

Generator function for the scope

Returns

PBInsideFunctionScope

The created scope

Inherited from

PBInsideFunctionScope.$scope


$if()

$if(condition, body): PBIfScope

Defined in: libs/device/src/builder/programbuilder.ts:3771

Creates an 'if' statement

Parameters

condition

ExpValueNonArrayType

Condition expression for the if statement

body

(this) => void

Generator function for the scope inside the if statement

Returns

PBIfScope

The scope inside the if statement

Inherited from

PBInsideFunctionScope.$if


$choice()

$choice(condition, first, second): PBShaderExp

Defined in: libs/device/src/builder/programbuilder.ts:3788

Creates a select statement: condition ? first : second

Parameters

condition

ExpValueNonArrayType

Condition expression

first

ExpValueNonArrayType

The first value

second

ExpValueNonArrayType

The second value

Returns

PBShaderExp

The first value if condition evaluates to true, otherwise returns the second value

Inherited from

PBInsideFunctionScope.$choice


$break()

$break(): void

Defined in: libs/device/src/builder/programbuilder.ts:3803

Creates a 'break' statement

Returns

void

Inherited from

PBInsideFunctionScope.$break


$continue()

$continue(): void

Defined in: libs/device/src/builder/programbuilder.ts:3807

Creates a 'continue' statement

Returns

void

Inherited from

PBInsideFunctionScope.$continue


$for()

$for(counter, init, end, open?, reverse?, body?): void

Defined in: libs/device/src/builder/programbuilder.ts:3817

Creates a 'for' statement

Parameters

counter

PBShaderExp

The repeat counter variable declaration

init

number | PBShaderExp

initial value of the repeat counter variable

end

number | PBShaderExp

end value of the counter exclusive

open?

boolean | ((this) => void)

reverse?

boolean | ((this) => void)

body?

(this) => void

Generator function for the scope that inside the for statement

Returns

void

Inherited from

PBInsideFunctionScope.$for


$do()

$do(body): PBDoWhileScope

Defined in: libs/device/src/builder/programbuilder.ts:3857

Creates a 'do..while' statement

Parameters

body

(this) => void

Generator function for the scope that inside the do..while statment

Returns

PBDoWhileScope

The scope that inside the do..while statement

Inherited from

PBInsideFunctionScope.$do


$while()

$while(condition, body): void

Defined in: libs/device/src/builder/programbuilder.ts:3870

Creates a 'while' statement

Parameters

condition

ExpValueNonArrayType

Condition expression for the while statement

body

(this) => void

Generator function for the scope that inside the while statement

Returns

void

Inherited from

PBInsideFunctionScope.$while


$getMainScope()

$getMainScope(): PBFunctionScope

Defined in: libs/device/src/builder/programbuilder.ts:3889

Gets main function scope

Returns

PBFunctionScope

Inherited from

PBInsideFunctionScope.$getMainScope


$isMain()

$isMain(): boolean

Defined in: libs/device/src/builder/programbuilder.ts:3925

Returns

boolean

Released under the MIT License.