# Configurator Callbacks

ConfiguratorKernel interface

# IO Context

# Log

void log(std::string logMessage,Logger::LogLevel level
interface ioContext {
    log(message : string) : void
    info(message : string) : void
    warn(message : string) : void
    error(message : string) : void
}

# KernelCallback

interface KernelCallback

# isReady

void is_ready();
isReady() : void

# loadComponent

void load_component(int_id_t conversation_id,  const Configuration&  configuration, int_id_t parent_id)
loadComponent(conversationId: number, configuration: ConfigurationObject, parentId: number) : void;

# loadSubComponent

void load_sub_component(int_id_t parentId, std::string partId, std::string componentId);
loadSubComponent(parentId: number, partId: number, componentId: string) : void;

# loadItemConfigurations

void load_item_configurations(int_id_t conversationId, const std::vector<std::string> &itemIds);
loadItemConfigurations(conversationId: number, itemIds: string[]): void;

# configurationLoaded

void configuration_loaded(int_id_t conversation_id, int_id_t loadedObjectId,int_id_t loadedRootComponentId, std::string aHash,const std::vector<std::string>* errors, bool valid);
configurationLoaded(conversationId: number, objectId: number, componentId: number, hash: string, errors: EmscriptenString[], valid: boolean) : void;

# configurationLoadingError

void configuration_loading_error(int_id_t conversation_id);
configurationLoadingError(_runtimeId: number, errors?: EmscriptenString[]) : void;

# componentDefinitionLoaded

void component_definition_loaded(int_id_t conversation_id, const std::string& componentId);
componentDefinitionLoaded(conversationId: number, componentId: number) : void;

# componentDefinitionLoadingError

void component_definition_loading_error(int_id_t conversation_id,const std::string& errorMessage);
componentDefinitionLoadingError(conversationId: number, errorMessage: string) : void;

# componentConfigurationUpdated

void component_configuration_updated(const int_id_t& componentId,const bool &isMeshChanged);
componentConfigurationUpdated(componentId: number, geometryChanged: boolean) : void;

Called when the configuration has changed. Indicates whether the configuration changes cause geometry changes.

# componentMetaUpdated

void component_meta_updated(const int_id_t& componentId);
componentMetaUpdated(kernelComponent: KernelComponent) : void;

Called when the component's position or orientation has changed.

# componentDeleted

void component_deleted(const int_id_t& componentId);
componentDeleted(componentId: number): void;

# Editor3dComponentCreated

void component_created(int_id_t convId, int_id_t componentId, Vector3f position, Vector3f rotation, int_id_t parent_id);
Editor3dComponentCreated(id: number, position: KernelVector3, eulerAngles: KernelVector3, parentObjectRuntimeId: number, isRootComponent: boolean): void;

# Editor3dRootComponentCreated

void root_component_created(int_id_t convId, int_id_t componentId, Vector3f position, Vector3f rotation, int_id_t parent_object_id);
Editor3dRootComponentCreated(id: number, position: KernelVector3, eulerAngles: KernelVector3, parentObjectId: number) : void

# Editor3dComponentDocked

void component_docked(int_id_t componentId, int_id_t parentId,  const Vector3f& componentPosition,  const Vector3f& componentRotation);
Editor3dComponentDocked(componentId: number, parentId: number, componentPosition: KernelVector3, componentRotation: KernelVector3): void;

# planObjectCreated

void planobject_created(int_id_t conversation_id, const int_id_t& anObjectId);
planObjectCreated(conversationId: number, planObjectId: number) : void;

# planObjectUpdated

void planobject_updated(const int_id_t& anObjectId);
public planObjectUpdated(planObjectId: number) : void;

# planObjectDeleted

void planobject_deleted(int_id_t aPlanObjectId);

Empty implementation in frontend.

planObjectDeleted(objectId) : void;

UNUSED RIGHT NOW BUT NEEDED FOR KERNEL

# planObjectConfigurationUpdated

void planobject_configuration_updated(int_id_t objectId, std::string configuration,std::string aHash, const std::string& rootComponentId, bool valid);
planObjectConfigurationUpdated(planObjectId: number, configuration: ConfigurationString, hash: string, valid: boolean): void;

# configurationSaved

void configuration_saved(int_id_t componentId, const std::string serializedConfig, const std::string aHash, const std::string& rootComponentId);

Is not implementation in frontend.

# sceneCleared

void scene_cleared();
sceneCleared(): void;

# listOfVariants

void list_of_variants(const std::string &aComponentId,const std::vector<Variant> &someVariants);

Empty implementation in frontend.

listOfVariants(_componentId: RapiId, _list: VariantsList): void;

# listOfVariantsError

void list_of_variants_error(const std::string &aComponentId,const std::string &errorMessage);
listOfVariantsError(dbId: RapiId, error: string) : void;

# requestMaterialsInGroup

void request_materials_in_groups(const std::vector<std::string> &materialGroups);
requestMaterialsInGroup(groupIds: string[]) 

# requestMaterialProperties

void request_material_properties(const std::vector<std::string> &materialNames);
requestMaterialProperties(materialIds: RapiId[]) : void

requests the properties for the given material id from the view. Expects the view to call ConfiguratorKernel::setMaterialProperties with the according properties.

# requestExternalMesh

void request_external_mesh(const std::string& meshId, roomle::meshCache::QualityLevel quality);
requestExternalMesh(meshId: string, quality: number) : void;

# Geometry callbacks

# Editor3dAddDockPreview

void add_dock_preview(int_id_t planComponentId,int_id_t previewId);
Editor3dAddDockPreview(componentId: number, previewId: number): void;

# Editor3dSetPreviewPointAssociations

void set_preview_point_associations(int_id_t previewId,const std::vector<DockPairToPoint> &dockPairs);
Editor3dSetPreviewPointAssociations(dockPairs: any, previewId: number): void;

# Editor3dSetPreviewLineAssociations

void set_preview_line_associations(int_id_t previewId,const std::vector<DockPairToLine> &dockPairs);
Editor3dSetPreviewLineAssociations(dockLines: any, previewId: number): void;

# Editor3dPreviewConstructionDone

void preview_construction_done(int_id_t planComponentId,int_id_t planObjectId);
Editor3dPreviewConstructionDone(componentId: number, objectId: number): void;

# Editor3dGeometryReady

void geometry_ready(int_id_t componentId);
Editor3dGeometryReady(id: number): void

# Editor3dGeometryNotReady

void geometry_not_ready(int_id_t componentId);
Editor3dGeometryNotReady(id: number): void

# Editor3dAddBakedMesh

void add_baked_mesh(
        int_id_t componentId,
        std::string material,
        const Matrix4f & transform,
        std::vector<Vector3f> vertices,
        std::vector<indices_t> indices,
        std::vector<Vector2f> uvCoords,
        std::vector<Vector3f> normals,
        bool environmentGeometry
);
Editor3dAddBakedMesh(
        runtimeComponentId: number,
        materialId: string,
        vertices: Int32Array,
        indices: Int32Array,
        uvCoords: Float32Array,
        normals: Float32Array,
        environmentGeometry: boolean
): void;

# Editor3dAddNamedMesh

void add_named_mesh(
        int_id_t componentId,
        std::string meshName,
        long meshId,
        std::string material,
        const Matrix4f & transform,
        std::vector<roomle::Vector3f> vertices,
        std::vector<indices_t> indices,
        std::vector<Vector2f> uvCoords,
        std::vector<roomle::Vector3f> normals,
        bool environmentGeometry,
        const Matrix3f &uvTransform
);
Editor3dAddNamedMesh(
        runtimeComponentId: number, 
        meshId: string, 
        geometryId: string, 
        materialId: string, 
        transform: Float32Array, 
        vertices: Int32fArray, 
        indices: Int32Array, 
        uvCoords: Float32Array, 
        normals: Float32Array, 
        environmentGeometry: boolean,
        uvTransform: Float32Array
): void;

# Editor3ChangedNamedMesh

void changed_named_mesh(int_id_t planComponentId, std::string meshHashName, long meshId, std::string materialId, const Matrix4f &transform, const Matrix3f &uvTransform);
Editor3ChangedNamedMesh(runtimeComponentId: number, meshId: string, geometryId: string, materiadlId: string, transform: Float32Array, uvTransform: Float32Array): void;

# Editor3dRemoveNamedMesh

void remove_named_mesh(int_id_t planComponentId, long meshId);
Editor3dRemoveNamedMesh(runtimeComponentId: number, geometryId: string): void;

# Editor3dEndConstruction

void end_construction(int_id_t componentId, bool isDeltaUpdate);
Editor3dBeginConstruction(componentId: number, isDeltaUpdate: boolean): void;

# Editor3dPlanObjectBeginConstruction

void planobject_begin_construction(int_id_t planObjectId);

Editor3dPlanObjectBeginConstruction not implemented in frontend. Called after construction for non free-flying object or merged constructions for any planobject is requested, before any construction for this object is sent.

# Editor3dPlanObjectAddBakedMesh

void planobject_add_baked_mesh(
        int_id_t planObjectId,
        std::string material,
        const Matrix4f &transform,
        const Matrix3f &uvTransform,
        std::vector<Vector3f> vertices,
        std::vector<indices_t> indices,
        std::vector<Vector2f> uvCoords,
        std::vector<Vector3f> normals
);

Editor3dPlanObjectAddBakedMesh id not implemented in frontend.
Sends a baked mesh (not named) for the given planObject.

# Editor3dPlanObjectAddNamedMesh

void planobject_add_named_mesh(
        int_id_t planObjectId,
        std::string meshId,
        std::string material,
        const Matrix4f &transform,
        const Matrix3f &uvTransform,
        std::vector<roomle::Vector3f> vertices,
        std::vector<indices_t> indices,
        std::vector<Vector2f> uvCoords,
        std::vector<roomle::Vector3f> normals
);

Editor3dPlanObjectAddNamedMesh is not implemented in frontend.
Sends a named mesh for the given planObject. if the view already knows the geometry for this mesh id, it should reuse it and discard the provided data. To be able to reuse it, the mesh is not baked into the current space but the necessary transform matrix is provided.

# Editor3dPlanObjectConstructionDone

void planobject_construction_done(int_id_t aPlanObjectId);
Editor3dPlanObjectConstructionDone(planObjectId: number): void;

Called after all construction calls for a requested planobject are sent (only sent if the construction was requested on planobjectlevel).