Skip to content

Expose a getMaterialByLocalId API to retrieve Material for fragment items #127

@mxvements

Description

@mxvements

Description 📝

This feature is necessary if you want to perform custom rendering and shading logic, and generally have full access to the visual metadata of the model.

Currently, although fragment models expose geometry via: getItemsGeometry(localIds), getItemsWithGeometry(), getGuidsByLocalIds(localIds), getLocalId(item), etc. And Material Definitions via .getItemsMaterialDefinition(localId), those material definition have no relation to the actual representation of the model (three materials) or ifc materials.

The materials are stored and used internally by the Fragments pipeline, but there is no mapping exposed between:
localId → THREE.MeshLambertMaterial
guid → THREE.MeshLambertMaterial

Suggested solution 💡

The Fragments API exposes a Material definition object:

const materials: {
    definition: MaterialDefinition;
    localIds: number[];
}[]

Maybe at least having the locallID group by their real material would be a way to handle this.

Alternative ⛕

No response

Additional context ☝️

I'm using:

		"@thatopen/components": "3.1.1",
		"@thatopen/components-front": "3.1.3",
		"@thatopen/fragments": "3.1.6",
		"@thatopen/ui": "3.1.1",
		"@thatopen/ui-obc": "3.1.2",
		"@types/dat.gui": "^0.7.13",
		"@types/react": "^19.1.10",
		"@types/react-dom": "^19.1.7",
		"@types/three": "^0.176.0",

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureSomething new that we could do

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions