Conforms to NSObject
Declared in NGLMesh.h

Overview

The NGLMeshDelegate protocol defines the basic methods for an object register itself as observer to the loading process.

The observer can receive one notification about the start of the process, can receive many notifications about the progress, one notification about the end of the progress and one notification in case of errors.

For a UI convenience (UIKit), all the notifications will be delivered as asynchronous methods called in the main thread.

IMPORTANT: The callbacks messages are delivered asynchronously on the MAIN THREAD for your convenience. The progress notifications is generated respecting the NinevehGL FPS, so you will receive this notification in the same frequency as the application’s FPS. Changing the FPS will immediately affect the interval of the progress notifications.

The notifications are about the loading process, which has two phases. There is no real difference between the notifications/messages of these phases. But NinevehGL follows a rule for these phases, the phases are:

  • Parse Phase (80%): The first 80% of the process is about parsing the 3D file;
  • Upload Phase (20%): The last 20% of the process is about the uploading.

While the process is under 80% the mesh can’t be rendered. Even if you try to make a render nothing will happen, the render call will be ignored. After the 80% the mesh can be rendered on the screen, however it is complete yet, you will see only some parts of the object (polygons).

For example, if you start loading a big city and place it in the render loop, during the first 80% of the loading process you will see nothing and after the 80% you can see some building and they will keep appearing until the loading process (upload phase) is done.

If you don’t want to show the object while it’s loading but want to place it in the render loop since the very begining, think about to set the #NGLMesh:visible# property to NO on the meshLoadingWillStart: callback and change it again to YES on the meshLoadingDidFinish: callback.

None of the following methods are mandatory.

Tasks

  • – meshLoadingWillStart:

    This is the very first method. This method is called even before the file be loaded in the memory.

  • – meshLoadingProgress:

    This method follows the NinevehGL FPS, that means, it’s called with the same frequency/interval as the NinevehGL render.

  • – meshLoadingDidFinish:

    This is the very last method. This method is called when the loading process is done.

  • – meshLoadingError:

    This method can be called at any time. Even when it’s called, all the other notifications will still happening.

Instance Methods

meshLoadingDidFinish:

This is the very last method. This method is called when the loading process is done.

- (void)meshLoadingDidFinish:(NGLParsing)parsing

Parameters

parsing

The parsing object.

Discussion

This is the very last method. This method is called when the loading process is done.

Declared In

NGLMesh.h

meshLoadingError:

This method can be called at any time. Even when it’s called, all the other notifications will still happening.

- (void)meshLoadingError:(NGLParsing)parsing

Parameters

parsing

The parsing object.

Discussion

This method can be called at any time. Even when it’s called, all the other notifications will still happening.

Declared In

NGLMesh.h

meshLoadingProgress:

This method follows the NinevehGL FPS, that means, it’s called with the same frequency/interval as the NinevehGL render.

- (void)meshLoadingProgress:(NGLParsing)parsing

Parameters

parsing

The parsing object.

Discussion

This method follows the NinevehGL FPS, that means, it’s called with the same frequency/interval as the NinevehGL render.

This method updates the progress property in the parsing object. The progress' value is the same as the progress property in the UIProgressView, a float number with the range [0.0, 1.0].

Declared In

NGLMesh.h

meshLoadingWillStart:

This is the very first method. This method is called even before the file be loaded in the memory.

- (void)meshLoadingWillStart:(NGLParsing)parsing

Parameters

parsing

The parsing object.

Discussion

This is the very first method. This method is called even before the file be loaded in the memory.

Declared In

NGLMesh.h