Banuba SDK
Instance Methods | List of all members
BNBMaterial Class Reference

Class, represents material interface. More...

#import <BNBMaterial.h>

Inheritance diagram for BNBMaterial:

Instance Methods

(nonnull NSString *) - getName
 
(void) - addParameter:
 adds shader parameter to parameters list, after what you'll can get access to this parameter in shader by it's name. More...
 
(nonnull NSArray< BNBParameter * > *) - getParameters
 
(void) - removeParameter:
 removes parameter from list. More...
 
(nullable BNBParameter *) - findParameter:
 find parameter by name More...
 
(void) - setTopology:
 set material geometry topology. More...
 
(BNBGeometryTopology) - getCurrentTopology
 
(void) - setState:
 sets render state (i.e blending mode, color/depth writing, depth testing, etc.) More...
 
(nonnull BNBState *) - getState
 
(void) - addImage:image:
 add image sampler, after what you'll can get acess to image and sampler in shader by formula: image_index = i * 2. More...
 
(nonnull NSArray< BNBImage * > *) - getImages
 
(void) - removeImage:
 removes image from list (if exist). More...
 
(nonnull NSArray< NSString * > *) - getSamplers
 
(nonnull BNBShaderSource *) - getShaderSource
 

Detailed Description

Class, represents material interface.

Definition at line 19 of file BNBMaterial.h.

Method Documentation

◆ addImage:image:

- (void) addImage: (nonnull NSString *)  sampler
image: (nullable BNBImage *)  image 

add image sampler, after what you'll can get acess to image and sampler in shader by formula: image_index = i * 2.

sampler_index = i * 2 + 1. Where i is image index in images list (which you can get by get_images call). Note that you need to declare images samplers in shader manually and sampler name in name must match with sampler name in material.

Parameters
sampler(string): sampler name
image(image): sampler image

◆ addParameter:

- (void) addParameter: (nullable BNBParameter *)  parameter

adds shader parameter to parameters list, after what you'll can get access to this parameter in shader by it's name.

Type of parameter in shader will match with type of parameter, except int, float, vector2, vector3, this types will be replaces on vec4, which x component will have needed value, other components will be filled by garbage.

Parameters
parameter(parameter): parameter to add

◆ findParameter:

- (nullable BNBParameter *) findParameter: (nonnull NSString *)  name

find parameter by name

Parameters
name(string)
Returns
parameter (parameter) or null

◆ getCurrentTopology

- (BNBGeometryTopology) getCurrentTopology
Returns
current geometry topology (geometry_topology)

◆ getImages

- (nonnull NSArray<BNBImage *> *) getImages
Returns
list of samplers images (list<parameter>)

◆ getName

- (nonnull NSString *) getName
Returns
material name (string)

◆ getParameters

- (nonnull NSArray<BNBParameter *> *) getParameters
Returns
list of shader parameters (list<parameter>)

◆ getSamplers

- (nonnull NSArray<NSString *> *) getSamplers
Returns
list of samplers name (list<string>)

◆ getShaderSource

- (nonnull BNBShaderSource *) getShaderSource
Returns
compiled and combined shaders sources

◆ getState

- (nonnull BNBState *) getState
Returns
render state (state)

◆ removeImage:

- (void) removeImage: (nonnull NSString *)  sampler

removes image from list (if exist).

Will be ignored if effect was activated.

Parameters
sampler(string): sampler name

◆ removeParameter:

- (void) removeParameter: (nullable BNBParameter *)  parameter

removes parameter from list.

Parameters
parameter(parameter): parameter to remove

◆ setState:

- (void) setState: (nonnull BNBState *)  state

sets render state (i.e blending mode, color/depth writing, depth testing, etc.)

Parameters
state(state) render state

◆ setTopology:

- (void) setTopology: (BNBGeometryTopology)  topology

set material geometry topology.

Parameters
topology(geometry_topology): geometry topology type. Can be triangles_list, lines_list, points_list. Default: triangles_list

The documentation for this class was generated from the following file: