ModelUtils

Public Methods

CreateCubeModel3

public static Model CreateCubeModel3(Vulkan vulkan)

Creates a 3D cube model with 3 faces (and 3 missing).

Parameters:

  • vulkan (Vulkan): The Vulkan instance to use for rendering.

Returns: Model

  • The created 3D cube model.

LoadEmbeddedResource

public static string LoadEmbeddedResource(string path, Type type)

Loads the content of an embedded resource as a string.

Parameters:

  • path (string): The path to the embedded resource.
  • type (Type): The type within the same assembly that contains the embedded resource.

Returns: string

  • The content of the embedded resource as a string.

GetEmbeddedResourceObjText

public static string GetEmbeddedResourceObjText(string filename)

Gets the text content of an embedded resource with the specified filename.

Parameters:

  • filename (string): The filename of the embedded resource.

Returns: string

  • The text content of the embedded resource.

LoadJsonFromGlb

public static string LoadJsonFromGlb(string path)

Reads the JSON chunk from a GLB (binary glTF) file without decoding the binary buffer.

Parameters:

  • path (string)

Returns: string

LoadGltfToBuilder

public static ModelBuilder LoadGltfToBuilder(string path)

Reads a glTF 2.0 file (.gltf or .glb) into a ModelBuilder.

Parameters:

  • path (string): The path to the glTF file.

Returns: ModelBuilder

LoadGltfEmbeddedImage

public static byte[]? LoadGltfEmbeddedImage(string path, int imageIndex)

Reads the encoded bytes (PNG, JPEG, …) of an image a glTF file embeds, either in a buffer view or as a data: URI.

Parameters:

  • path (string): The path to the glTF file.
  • imageIndex (int): Index into the file's images array.

Returns: byte[]?

  • The image bytes, or null when the image is an external file or does not exist.

CreateCubeModel6

public static Model CreateCubeModel6(Vulkan vulkan)

Creates a 3D cube model with 6 faces.

Parameters:

  • vulkan (Vulkan): The Vulkan instance to use for rendering.

Returns: Model

  • The created 3D cube model.