Inherits from NSObject
Declared in NGLSLShader.h

Overview

Constructs a complete shader string to compile later on.

NGLSLShader is prepared to integrate many shader files and/or strings into one single shader. You can set the header and body of the shader separately.

Tasks

Properties

bodyData

The current body string.

@property (nonatomic, readonly) NSString *bodyData

Discussion

The current body string.

Declared In

NGLSLShader.h

headerData

The current header string.

@property (nonatomic, readonly) NSString *headerData

Discussion

The current header string.

Declared In

NGLSLShader.h

shaderData

The final shader data. This string contains the shader in the final format according to the GLSL ES.

@property (nonatomic, readonly) NSString *shaderData

Discussion

The final shader data. This string contains the shader in the final format according to the GLSL ES.

Declared In

NGLSLShader.h

Instance Methods

addBody:mode:

Joins a new body content within the current shader content.

- (void)addBody:(NSString *)body mode:(NGLSLAddMode)mode

Parameters

body

A NSString containing the new body.

mode

Specifies the mode in which the new content will be added.

Discussion

Joins a new body content within the current shader content.

The new content will be added following the mode instructions. It can be added first, last or replace the old content.

Declared In

NGLSLShader.h

addFromFile:mode:

Joins new shader content from a file within the current shader content.

- (void)addFromFile:(NSString *)filePath mode:(NGLSLAddMode)mode

Parameters

filePath

A NSString containing the path. It uses NinevehGL Path API.

mode

Specifies the mode in which the new content will be added.

Discussion

Joins new shader content from a file within the current shader content.

The new content will be added following the mode instructions. It can be added first, last or replace the old content.

Declared In

NGLSLShader.h

addFromShader:mode:

Joins new shader content from another NGLSLShader within the current shader content.

- (void)addFromShader:(NGLSLShader *)shader mode:(NGLSLAddMode)mode

Parameters

shader

A NGLSLShader instance.

mode

Specifies the mode in which the new content will be added.

Discussion

Joins new shader content from another NGLSLShader within the current shader content.

The new content will be added following the mode instructions. It can be added first, last or replace the old content.

Declared In

NGLSLShader.h

addFromString:mode:

Joins new shader content from a string within the current shader content.

- (void)addFromString:(NSString *)string mode:(NGLSLAddMode)mode

Parameters

string

A NSString containing the new shader content.

mode

Specifies the mode in which the new content will be added.

Discussion

Joins new shader content from a string within the current shader content.

The new content will be added following the mode instructions. It can be added first, last or replace the old content.

Declared In

NGLSLShader.h

addHeader:mode:

Joins a new header content within the current shader content.

- (void)addHeader:(NSString *)header mode:(NGLSLAddMode)mode

Parameters

header

A NSString containing the new header.

mode

Specifies the mode in which the new content will be added.

Discussion

Joins a new header content within the current shader content.

The new content will be added following the mode instructions. It can be added first, last or replace the old content.

Declared In

NGLSLShader.h

hasBody:

Searches for a string/pattern inside this shader.

- (BOOL)hasBody:(NSString *)pattern

Parameters

pattern

A string representing the literal search or a RegEx pattern.

Discussion

Searches for a string/pattern inside this shader.

The string can be a literal string or a RegEx pattern. This method will search for the pattern in the body only. That means, will search for a usage.

Declared In

NGLSLShader.h

hasHeader:

Searches for a string/pattern inside this shader.

- (BOOL)hasHeader:(NSString *)pattern

Parameters

pattern

A string representing the literal search or a RegEx pattern.

Discussion

Searches for a string/pattern inside this shader.

The string can be a literal string or a RegEx pattern. This method will search for the pattern in the header only. That means, will search for a declaration.

Declared In

NGLSLShader.h

hasPattern:

Searches for a string/pattern inside this shader.

- (BOOL)hasPattern:(NSString *)pattern

Parameters

pattern

A string representing the literal search or a RegEx pattern.

Discussion

Searches for a string/pattern inside this shader.

The string can be a literal string or a RegEx pattern. This method will search for the pattern in all the shader, including header and body.

Declared In

NGLSLShader.h

initWithFile:

Initializes this NGLSLShader based on a shader file.

- (id)initWithFile:(NSString *)filePath

Parameters

filePath

The path to the file using NinevehGL Path API.

Return Value

A new initialized NGLSLShader instance.

Discussion

Initializes this NGLSLShader based on a shader file.

Any previous string in this shader will be deleted and replaced by the new content. The file will be searched using the NinevehGL Path API.

Declared In

NGLSLShader.h

initWithHeader:andBody:

Initializes this NGLSLShader based on a header and a body strings.

- (id)initWithHeader:(NSString *)header andBody:(NSString *)body

Parameters

header

A NSString containing the new header.

body

A NSString containing the new body.

Return Value

A new initialized NGLSLShader instance.

Discussion

Initializes this NGLSLShader based on a header and a body strings.

Any previous string in this shader will be deleted and replaced by the new content.

Declared In

NGLSLShader.h

initWithShader:

Initializes this NGLSLShader based on another NGLSLShader.

- (id)initWithShader:(NGLSLShader *)shader

Parameters

shader

The NGLSLShader instance.

Return Value

A new initialized NGLSLShader instance.

Discussion

Initializes this NGLSLShader based on another NGLSLShader.

Any previous string in this shader will be deleted and replaced by the new content.

Declared In

NGLSLShader.h

initWithString:

Initializes this NGLSLShader based on a shader file.

- (id)initWithString:(NSString *)string

Parameters

string

The shader string.

Return Value

A new initialized NGLSLShader instance.

Discussion

Initializes this NGLSLShader based on a shader file.

Any previous string in this shader will be deleted and replaced by the new content.

Declared In

NGLSLShader.h