public interface JCGLAsyncResourceLoaderType
The type of asynchronous resource loaders.
An asynchronous resource loader attempts to simplify the allocation and population of OpenGL resources by evaluating user-provided functions on a pool of worker threads, and creating shared OpenGL objects on a dedicated OpenGL context.
The interface tries to provide a generalized and type-safe interface to allow programmers to conveniently load textures and 3D mesh data asynchronously, without the interface itself having to know anything about the source of the data.
| Modifier and Type | Method and Description |
|---|---|
<T> CompletableFuture<JCGLAsyncBufferPair> |
loadArrayIndexBuffers(Supplier<T> on_data,
Function<T,Long> on_array_size,
JCGLUsageHint array_usage,
Function<T,Long> on_index_size,
JCGLUnsignedType index_type,
JCGLUsageHint index_usage,
BiFunction<T,JCGLArrayBufferType,JCGLBufferUpdateType<JCGLArrayBufferType>> on_populate_array,
BiFunction<T,JCGLIndexBufferType,JCGLBufferUpdateType<JCGLIndexBufferType>> on_populate_index)
Asynchronously create an array and index buffer pair.
|
CompletableFuture<JCGLTexture2DType> |
loadTexture(Supplier<JCGLTLTextureDataType> on_data,
JCGLTextureFormat format,
JCGLTextureWrapS wrap_s,
JCGLTextureWrapT wrap_t,
JCGLTextureFilterMinification min_filter,
JCGLTextureFilterMagnification mag_filter,
BiFunction<JCGLTexture2DType,JCGLTLTextureDataType,JCGLTexture2DUpdateType> on_populate)
Asynchronously load a texture.
|
CompletableFuture<JCGLTexture2DType> loadTexture(Supplier<JCGLTLTextureDataType> on_data, JCGLTextureFormat format, JCGLTextureWrapS wrap_s, JCGLTextureWrapT wrap_t, JCGLTextureFilterMinification min_filter, JCGLTextureFilterMagnification mag_filter, BiFunction<JCGLTexture2DType,JCGLTLTextureDataType,JCGLTexture2DUpdateType> on_populate)
Asynchronously load a texture. The given on_data function is
evaluated, yielding texture data. A texture is allocated with the given
parameters, and then the on_populate function is evaluated,
yielding a JCGLTexture2DUpdateType which is then used to populate
the texture.
All functions are evaluated on an arbitrary number of background worker threads.
on_data - A function that returns texture dataformat - The allocated texture formatwrap_s - The allocated texture wrapping mode on the S axiswrap_t - The allocated texture wrapping mode on the T axismin_filter - The allocated texture minification filtermag_filter - The allocated texture magnification filteron_populate - A function that returns a texture update<T> CompletableFuture<JCGLAsyncBufferPair> loadArrayIndexBuffers(Supplier<T> on_data, Function<T,Long> on_array_size, JCGLUsageHint array_usage, Function<T,Long> on_index_size, JCGLUnsignedType index_type, JCGLUsageHint index_usage, BiFunction<T,JCGLArrayBufferType,JCGLBufferUpdateType<JCGLArrayBufferType>> on_populate_array, BiFunction<T,JCGLIndexBufferType,JCGLBufferUpdateType<JCGLIndexBufferType>> on_populate_index)
Asynchronously create an array and index buffer pair. The given on_data function is evaluated on a worker thread, yielding user data
d. The on_array_size function is passed d and is
expected to return the size in bytes of the array buffer that should be
allocated. The on_index_size function is passed d and is
expected to return the size in bytes of the index buffer that should be
allocated. The on_populate_array function is evaluated, and is
passed d and the allocated array buffer, and is expected to yield
an JCGLBufferUpdateType value that can be used to populate the
array buffer with data. The on_populate_index function is
evaluated, and is passed d and the allocated index buffer, and is
expected to yield an JCGLBufferUpdateType value that can be used to
populate the index buffer with data.
All functions are evaluated on an arbitrary number of background worker threads.
T - The type of user dataon_data - A function that returns an abstract user data
valueon_array_size - A function that yields an array buffer sizearray_usage - The array buffer usage hinton_index_size - A function that yields an index buffer sizeindex_type - The type of index buffer indicesindex_usage - The index buffer usage hinton_populate_array - A function that yields a buffer update, used to
populate the array bufferon_populate_index - A function that yields a buffer update, used to
populate the index bufferCopyright © 2017 <code@io7m.com> http://io7m.com