modules.images#
- class modules.images.Images(*args: Any, **kwargs: Any)#
Bases:
Context- class Queue(image_index: int = -1, flip_x: bool = False, flip_y: bool = True, base: 'Images.ImageUpload' = None)#
Bases:
object- __init__(image_index: int = -1, flip_x: bool = False, flip_y: bool = True, base: Images.ImageUpload = None) None#
- base: Images.ImageUpload#
- flip_x: bool#
- flip_y: bool#
- image_index: int#
- __init__(context)#
Setup image buffers that store the GPU texture uid’s and paths for fast loading Also create the defaul, white, black and PBR textures
- Parameters:
context (EmberEngine) – This is the main context of the application
- bind(image_index: int, texture_index, shader_uniform: str, shader_index: int)#
Bind texture using OpenGL with image index
- Parameters:
image_index (int) – the image index point to image list containing the texture uid in GPU memory
texture_index (uint32/uintc) – The texture unit index in GLSL (eg. GL_TEXTURE0-GL_TEXTURE31)
shader_uniform (str) – The varaible name of the GLSL uniform sampler
shader_index (int) – Represent the number also indicated with ‘texture_index’. revisit this?
- bind_gl(texture_id: int, texture_index, shader_uniform: str, shader_index: int)#
Bind texture using OpenGL with image index
- Parameters:
texture_id (uint32/uintc) – the texture uid in GPU memory
texture_index (uint32/uintc) – The texture unit index in GLSL (eg. GL_TEXTURE0-GL_TEXTURE31)
shader_uniform (str) – The varaible name of the GLSL uniform sampler
shader_index (int) – Represent the number also indicated with ‘texture_index’. revisit this?
- static create_black_image(size)#
- create_default_physical_image() int#
Create a 256x256 texture where each channel represents a phyisical kind, occlusion, roughness, metallic Current map format is ORM (occlusion, roughness, metallic )
- static create_grey_image(size)#
- static create_white_image(size)#
- get_by_path(path: Path)#
- get_gl_texture(image_index)#
Get the GPU uid of a texture
- Parameters:
image_index (int) – the image index point to image list containing the texture uid in GPU memory
- Param:
the texture uid in GPU memory
- Return type:
uint32/uintc
- image_upload_queue_flush() None#
- loadFromPixels(width, height, buffer, path: Path = None)#
Submit image data to the upload queue, Path is optional
- loadOrFindFullPath(path: Path, flip_x: bool = False, flip_y: bool = True) int#
Load or find existing texture
- Parameters:
path (Path) – The path to the texture
- Returns:
the image index point to image list containing the texture uid in GPU memory
- Return type:
int
- loadOrFindPhysicalMap(roughness_path: Path, metallic_path: Path, ao_path: Path) int#
Load/Create/Combine a physical RMO texture. Find from cache is not implemented yet.
- Parameters:
roughness_path (Path)
metallic_path (Path)
ao_path (Path)
- Returns:
the image index point to image list containing the texture uid in GPU memory
- Return type:
int
- make_bindless(image_index: int, texture_id)#
Create a bindless handle for a texture an map it
- pixelsToImage(data, path: Path = None)#
- queue_upload(upload_data: ImageUpload) int#
- tex_to_bindless(index)#