LDKMaterialAlphaMode
typedef enum LDKMaterialAlphaMode{
LDK_MATERIAL_ALPHA_MODE_OPAQUE=0,
LDK_MATERIAL_ALPHA_MODE_CUTOUT=1,
LDK_MATERIAL_ALPHA_MODE_BLEND=2
}LDKMaterialAlphaMode;
typedef enum LDKMaterialAlphaMode{
LDK_MATERIAL_ALPHA_MODE_OPAQUE=0,
LDK_MATERIAL_ALPHA_MODE_CUTOUT=1,
LDK_MATERIAL_ALPHA_MODE_BLEND=2
}LDKMaterialAlphaMode;
typedef union LDKMaterialArgs{
LDKMaterialTexturedArgs textured;
LDKMaterialVertexColorArgs vertex_color;
}LDKMaterialArgs;
typedef struct LDKMaterialDesc{
LDKMaterialType type;
LDKMaterialArgs args;
LDKMaterialSurfaceArgs surface;
LDKAssetImage additional_textures[LDK_MATERIAL_ADDITIONAL_TEXTURE_COUNT];
u32 texture_slot_mask;
LDKMaterialTextureSettings texture_settings[LDK_MATERIAL_TEXTURE_SLOT_COUNT];
LDKAssetTextureAtlas texture_atlases[LDK_MATERIAL_TEXTURE_SLOT_COUNT];
u64 texture_regions[LDK_MATERIAL_TEXTURE_SLOT_COUNT];
LDKMaterialAlphaMode alpha_mode;
float alpha_cutoff;
}LDKMaterialDesc;
typedef struct LDKMaterialSurfaceArgs{
float specular;
float shininess;
float emission;
LDKAssetImage normal_map;
LDKAssetImage specular_map;
}LDKMaterialSurfaceArgs;
typedef enum LDKMaterialType{
LDK_MATERIAL_TYPE_INVALID=0,
LDK_MATERIAL_TYPE_TEXTURED_UNLIT=1,
LDK_MATERIAL_TYPE_TEXTURED=2,
LDK_MATERIAL_TYPE_VERTEX_COLOR_UNLIT=3,
LDK_MATERIAL_TYPE_VERTEX_COLOR=4
}LDKMaterialType;
typedef struct LDKMaterialVertexColorArgs{
rgba32 color;
}LDKMaterialVertexColorArgs;
Initialize a material descriptor with deterministic defaults. Every supported material type defaults to opaque white, opaque alpha mode, and a 0.5 cutout threshold. Textured materials also default to a null image asset, nearest filtering, no mip filtering, clamp-to-edge wrapping, and identity UV transform. Additional texture slots default to null. Lit materials default to no specular contribution, shininess 32, no emission, and no normal/specular maps. On failure, out_desc is reset to an invalid zero descriptor.
LDK_API bool ldk_material_desc_defaults(
LDKMaterialType type,
LDKMaterialDesc *out_desc
);
LDKMaterialType typeLDKMaterialDesc *out_desctrue on success, false for an invalid type or null destination.
Compare the active values of two material descriptors exactly.
LDK_API bool ldk_material_desc_equal(
LDKMaterialDesc const *a,
LDKMaterialDesc const *b
);
LDKMaterialDesc const *aLDKMaterialDesc const *btrue when both descriptors represent the same authored material.
Hash the active values of a material descriptor.
LDK_API u64 ldk_material_desc_hash(LDKMaterialDesc const *desc);
LDKMaterialDesc const *descDeterministic hash, or zero for a null or invalid descriptor.
Check whether a descriptor has a supported material type. This validates the descriptor structure only. Asset availability is validated later by the asset/material resolver. Textured cutout thresholds must be finite and within [0, 1]. Active lit surface values must be finite and non-negative. A zero shininess is canonicalized to the default value (32) so zero-initialized descriptors remain valid.
LDK_API bool ldk_material_desc_is_valid(LDKMaterialDesc const *desc);
LDKMaterialDesc const *desctrue when the descriptor is structurally valid.
Check whether a value identifies a supported material type.
LDK_API bool ldk_material_type_is_valid(LDKMaterialType type);
LDKMaterialType typetrue for a supported material type, false otherwise.