PbrFeatureKey

from acron.shading import PbrFeatureKey
class PbrFeatureKey

Bases:

What one PBR shader permutation does: the part of a RenderState (and of the generator’s options) that changes the GLSL, as opposed to the values that reach it as uniforms. Equal keys share one Shader.

Static: which texture maps exist (and their UV set and transform), the alpha mode, double-sidedness, unlit, the light-count bucket (a multiple of 4, at most shading-max-lights), the number of shadow-casting lights of each map kind (at most shading-max-shadows in all), ambient light, image-based light, the shadow filter’s taps, the generator’s spec-AA and multiscatter switches, depth-only (the shadow pass’s shader), and the LightingContext with its revision. Everything else (factors, colours, light positions and intensities, exposure) is a uniform.

Inheritance diagram

digraph inheritancec806ad250d { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "PbrFeatureKey" [URL="acron.shading.PbrFeatureKey.html#acron.shading.PbrFeatureKey",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "PbrFeatureKey" [arrowsize=0.75,style=""]; }
enum Feature
enumerator F_unlit = 1
enumerator F_alpha_mask = 2
enumerator F_alpha_blend = 4
enumerator F_double_sided = 8
enumerator F_ambient = 16
enumerator F_ibl = 32
enumerator F_spec_aa = 64
enumerator F_multiscatter = 128
enumerator F_orm = 256

occlusion in the metal-rough map’s red

enumerator F_depth_only = 512

no colour: a shadow or depth pass

enum TextureRole
enumerator TR_base = 0
enumerator TR_metal_rough = 1
enumerator TR_occlusion = 2
enumerator TR_normal = 3
enumerator TR_emission = 4
enumerator TR_num_roles = 5
__eq__()
__init__()

The key of an opaque surface without maps or lights.

__lt__()
__ne__()
clear_texture()
compare_to()
property context → LightingContext
Getter

The state’s LightingContext, or nullptr for the default context.

Setter

Records the state’s context (nullptr: the default) at its current revision.

get_context()

The state’s LightingContext, or nullptr for the default context.

get_context_revision()

The context’s revision when it was set on the key.

get_defines()

The #define lines the shader is compiled with.

get_flags()
get_hash()
get_num_lights()

The size of the acron_LightSource array (a bucket, not the exact count).

get_num_samplers()

The samplers the fragment stage reads: the maps, the DFG table, the environment cube, the shadow maps and the context’s.

get_num_shadows_2d()

The number of shadow-casting spotlights and directional lights (0 to 4).

get_num_shadows_cube()

The number of shadow-casting point lights (0 to 4).

get_num_texture_matrices()

The length the acron_TextureMatrix array must have (0: none is read).

static get_role_name()
get_shadow_taps()

The hardware-compared taps the shader reads per shadow map and pixel (1 to 32; 0 when the key has no shadows).

get_texture_matrix()

The index of the role’s TextureStage in acron_TextureMatrix, or -1.

get_texture_uv()

The UV set of the role’s map (0 or 1), or -1 without one.

has_feature()
has_texture()
property num_lights → int
Getter

The size of the acron_LightSource array (a bucket, not the exact count).

Setter

property num_shadows_2d → int
Getter

The number of shadow-casting spotlights and directional lights (0 to 4).

Setter

property num_shadows_cube → int
Getter

The number of shadow-casting point lights (0 to 4).

Setter

output()

A one-line description, e.g. “lights=4 ambient spec_aa multiscatter base(uv0) normal(uv0,m2)”.

set_context()

Records the state’s context (nullptr: the default) at its current revision.

set_feature()
set_num_lights()
set_num_shadows_2d()
set_num_shadows_cube()
set_shadow_taps()
set_texture()

Records a map for the role, read with the given UV set (0 or 1) and, if matrix_index >= 0, transformed by acron_TextureMatrix[matrix_index].

property shadow_taps → int
Getter

The hardware-compared taps the shader reads per shadow map and pixel (1 to 32; 0 when the key has no shadows).

Setter