Skip to content

modosaic.normals.generators.factory

modosaic.normals.generators.factory

NormalsGenerationModel

Bases: Enum

Normals generator implementations supported by the factory.

NormalsGeneratorFactory

Factory for surface-normal generator implementations.

get staticmethod

get(normals_model=NormalsGenerationModel.OMNIDATA)

Create a normals generator.

Parameters:

Name Type Description Default
normals_model NormalsGenerationModel

Model implementation to instantiate.

OMNIDATA

Returns:

Type Description
NormalsGenerator

Configured normals generator.

Raises:

Type Description
ValueError

If the model is unsupported.

Source code in modosaic/normals/generators/factory.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@staticmethod
def get(normals_model: NormalsGenerationModel = NormalsGenerationModel.OMNIDATA) -> NormalsGenerator:
    """Create a normals generator.

    Args:
        normals_model: Model implementation to instantiate.

    Returns:
        Configured normals generator.

    Raises:
        ValueError: If the model is unsupported.
    """
    logger.debug(f"Creating normals generator for model {normals_model}")
    match normals_model:
        case NormalsGenerationModel.OMNIDATA:
            return Omnidata()
        case NormalsGenerationModel.MIDAS_D2N:
            return MidasD2N()
        case _:
            raise ValueError(f"Unsupported normals generation model: {normals_model}")