Enum in ldk_material.h

LDKMaterialType

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;
Enum in ldk_material.h

LDKMaterialAlphaMode

typedef enum LDKMaterialAlphaMode{
  LDK_MATERIAL_ALPHA_MODE_OPAQUE=0,
  LDK_MATERIAL_ALPHA_MODE_CUTOUT=1,
  LDK_MATERIAL_ALPHA_MODE_BLEND=2
}LDKMaterialAlphaMode;
Enum in ldk_material.h

LDKMaterialTextureFilter

typedef enum LDKMaterialTextureFilter{
  LDK_MATERIAL_TEXTURE_FILTER_NEAREST=0,
  LDK_MATERIAL_TEXTURE_FILTER_LINEAR=1
}LDKMaterialTextureFilter;
Enum in ldk_material.h

LDKMaterialTextureWrap

typedef enum LDKMaterialTextureWrap{
  LDK_MATERIAL_TEXTURE_WRAP_REPEAT=0,
  LDK_MATERIAL_TEXTURE_WRAP_CLAMP=1,
  LDK_MATERIAL_TEXTURE_WRAP_MIRROR=2
}LDKMaterialTextureWrap;
Enum in ldk_material.h

LDKMaterialTextureMipFilter

typedef enum LDKMaterialTextureMipFilter{
  LDK_MATERIAL_TEXTURE_MIP_FILTER_NONE=0,
  LDK_MATERIAL_TEXTURE_MIP_FILTER_NEAREST=1,
  LDK_MATERIAL_TEXTURE_MIP_FILTER_LINEAR=2
}LDKMaterialTextureMipFilter;
Macro in ldk_material.h

LDK_MATERIAL_TEXTURE_SLOT_COUNT

#define LDK_MATERIAL_TEXTURE_SLOT_COUNT 8u
Macro in ldk_material.h

LDK_MATERIAL_ADDITIONAL_TEXTURE_COUNT

#define LDK_MATERIAL_ADDITIONAL_TEXTURE_COUNT 5u
Enum in ldk_material.h

LDKMaterialTextureSlot

typedef enum LDKMaterialTextureSlot{
  LDK_MATERIAL_TEXTURE_SLOT_ALBEDO=0,
  LDK_MATERIAL_TEXTURE_SLOT_NORMAL=1,
  LDK_MATERIAL_TEXTURE_SLOT_SPECULAR=2,
  LDK_MATERIAL_TEXTURE_SLOT_3=3,
  LDK_MATERIAL_TEXTURE_SLOT_4=4,
  LDK_MATERIAL_TEXTURE_SLOT_5=5,
  LDK_MATERIAL_TEXTURE_SLOT_6=6,
  LDK_MATERIAL_TEXTURE_SLOT_7=7
}LDKMaterialTextureSlot;
Struct in ldk_material.h

LDKMaterialVertexColorArgs

typedef struct LDKMaterialVertexColorArgs{
  rgba32 color;
}LDKMaterialVertexColorArgs;
Struct in ldk_material.h

LDKMaterialSurfaceArgs

typedef struct LDKMaterialSurfaceArgs{
  float specular;
  float shininess;
  float emission;
  LDKAssetImage normal_map;
  LDKAssetImage specular_map;
}LDKMaterialSurfaceArgs;
Struct in ldk_material.h

LDKMaterialDesc

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;
Function in ldk_material.h

ldk_material_type_is_valid

Check whether a value identifies a supported material type.

LDK_API bool ldk_material_type_is_valid(LDKMaterialType type);

Parameters

LDKMaterialType type
Material type to inspect.

Returns

true for a supported material type, false otherwise.

Function in ldk_material.h

ldk_material_desc_defaults

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
);

Parameters

LDKMaterialType type
Material type whose defaults should be produced.
LDKMaterialDesc *out_desc
Destination descriptor.

Returns

true on success, false for an invalid type or null destination.

Function in ldk_material.h

ldk_material_desc_is_valid

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);

Parameters

LDKMaterialDesc const *desc
Descriptor to inspect.

Returns

true when the descriptor is structurally valid.

Function in ldk_material.h

ldk_material_texture_slot_get

Return the image assigned to a material texture slot.

LDK_API LDKAssetImage ldk_material_texture_slot_get(
 LDKMaterialDesc const *desc,
 u32 slot
);

Parameters

LDKMaterialDesc const *desc
Description or configuration for this operation.
u32 slot
Resource or binding slot identifier.

Returns

Handle to the requested object or resource.

Function in ldk_material.h

ldk_material_texture_slot_set

Assign an image to a material texture slot.

LDK_API bool ldk_material_texture_slot_set(
 LDKMaterialDesc *desc,
 u32 slot,
 LDKAssetImage image
);

Parameters

LDKMaterialDesc *desc
Description or configuration for this operation.
u32 slot
Resource or binding slot identifier.
LDKAssetImage image
Image used by this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_material.h

ldk_material_texture_atlas_set

Assign an atlas region to a material slot; region 0 means full atlas.

LDK_API bool ldk_material_texture_atlas_set(
 LDKMaterialDesc *desc,
 u32 slot,
 LDKAssetTextureAtlas atlas,
 u64 region
);

Parameters

LDKMaterialDesc *desc
Description or configuration for this operation.
u32 slot
Resource or binding slot identifier.
LDKAssetTextureAtlas atlas
Texture atlas being inspected or modified.
u64 region
Region used by this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_material.h

ldk_material_texture_settings_get

Return independent settings, or the legacy material defaults.

LDK_API LDKMaterialTextureSettings ldk_material_texture_settings_get(
 LDKMaterialDesc const *desc,
 u32 slot
);

Parameters

LDKMaterialDesc const *desc
Description or configuration for this operation.
u32 slot
Resource or binding slot identifier.

Returns

The requested value.

Function in ldk_material.h

ldk_material_desc_hash

Hash the active values of a material descriptor.

LDK_API u64 ldk_material_desc_hash(LDKMaterialDesc const *desc);

Parameters

LDKMaterialDesc const *desc
Descriptor to hash.

Returns

Deterministic hash, or zero for a null or invalid descriptor.