To use the renderer API you must include javascript API into your html file.
Initialize Viewport¶
var viewport = new Tailormate3d(options);
Parameters¶
optionsObject?options.containerHTMLElementdocument.getElementById('container')(optional, default : document.body)baseUrlString? Server URL (Required) -https://tailormate3d.com/{instanceName}/apikeyString? API Key required to access the data from server (Required)options.offsetWidthNumber canvas element width (optional, default : Container element width)options.offsetHeightNumber canvas element height (optional, default : Container element height)options.shadowBoolean Enable/Disable 3d object shadow (optional, defaultfalse)
Returns ViewportObject
Functions¶
resize¶
Resize the viewport
Parameters¶
Example:
viewport.resize(width,height);
loadScene¶
Load 3d scene into the viewport
Parameters¶
sceneReferenceIdString? Reference id of scene (Required) - find in data APIoptionsObject? (required in case of callback)options.scaleNumber change the scale of object - Float (optional, default : 1)options.positionXNumber change the x position of object - Float (optional, default : 1)options.positionYNumber change the y position of object - Float (optional, default : 1)options.positionZNumber change the z position of object - Float (optional, default : 1)
callbackFunction? called on completion with one arguments(err, info).infocontains the scene data.
Example:
var options = {};
viewport.loadScene('spread_collar',options,function(err, info){
});
Returns -
getListOfObjectsLoaded¶
Get list of objects loaded on the viewport
Returns¶
array Array? Array of objects
Example:
viewport.getListOfObjectsLoaded();
Sample return:
[{
'Name' : 'spread_collar_inner',
'Id' : 'spread_collar_inner',
'SceneId': 'spread_collar',
'Visibility' : true
},{
'Name' : 'spread_collar_outer',
'Id' : 'spread_collar_outer',
'SceneId': 'spread_collar',
'Visibility' : true
}]
hideScene¶
Hide scene on the viewport
Parameters¶
sceneIdString? Scene id (Required)
Example:
viewport.hideScene('{sceneId}');
showScene¶
Show the hidden scene on the viewport
Parameters¶
sceneIdString? Scene id (Required)
Example:
viewport.showScene('{sceneId}');
removeScene¶
Remove scene from the viewport
Parameters¶
sceneIdString? Scene id (Required)
Example:
viewport.removeScene('{sceneId}');
hideObject¶
Hide particular scene object on the viewport
Parameters¶
objectIdString? Object id (Required) - find in getListOfObjectsLoaded function
Example:
viewport.hideObject('{objectId}');
showObject¶
Show the previous hidden scene object on the viewport
Parameters¶
objectIdString? Object id (Required) - find in getListOfObjectsLoaded function
Example:
viewport.showObject('{objectId}');
removeObject¶
Remove object from the viewport
Parameters¶
objectIdString? Object id (Required) - find in getListOfObjectsLoaded function
Example:
viewport.removeObject('{objectId}');
flipBack¶
Show the back part of the scene
Example:
viewport.flipBack();
resetPosition¶
Reset the position of all scenes loaded on viewport
Example:
viewport.resetPosition();
loadTextureBySceneId¶
Render the texture on the scene (Find the texture in designs data API)
Parameters¶
imageUrlString? Design image urlhttps://tailormate3d.com/{instanceName}/texture/{referenceId}sceneIdString? Scene idoptionsObject? (required in case of callback)onSuccessFunction? called on completion with no argument.onErrorFunction? called on fail to load with one argument(error). Error?onProgressFunction? called on progress to load with one argument(progress). Progress?
Example:
var url = 'https://tailormate3d.com/{instanceName}/texture/{referenceId}';
var options = {
repeatSet: 5
};
viewport.loadTextureBySceneId(url,'spread_collar',options,function(){
//Call on success
}, function(error){
//Call on error
},function(progress){
//Call on progress
});
loadTextureByName¶
Render the texture on specific scene object (Find the texture in designs data API)
Parameters¶
imageUrlString? Design image urlhttps://tailormate3d.com/{instanceName}/texture/{referenceId}sceneIdString? Object idoptionsObject? (required in case of callback)onSuccessFunction? called on completion with no argument.onErrorFunction? called on fail to load with one argument(error). Error?onProgressFunction? called on progress to load with one argument(progress). Progress?
Example:
var url = 'https://tailormate3d.com/{instanceName}/texture/{referenceId}';
var options = {
repeatSet: 5
};
viewport.loadTextureByName(url,'spread_collar',options,function(){
//Call on success
}, function(error){
//Call on error
},function(progress){
//Call on progress
});
loadColorBySceneId¶
Render the RGB color on the scene
Parameters¶
rNumber? Red color of RGB - Integer 0 to 255 (required)gNumber? Green color of RGB - Integer 0 to 255 (required)bNumber? Blue color of RGB - Integer 0 to 255 (required)sceneIdString? Scene idoptionsObject? (required in case of callback)onSuccessFunction? called on completion with no argument.onErrorFunction? called on fail to load with no argument. Error due to invalid RGB color
Example:
var url = 'https://tailormate3d.com/{instanceName}/texture/{referenceId}';
var options = {};
viewport.loadColorBySceneId(212,112,32,'spread_collar',options,function(){
//Call on success
}, function(error){
//Call on error
});
loadColorByName¶
Render the RGB color on specific scene object
Parameters¶
rNumber? Red color of RGB - Integer 0 to 255 (required)gNumber? Green color of RGB - Integer 0 to 255 (required)bNumber? Blue color of RGB - Integer 0 to 255 (required)sceneIdString? Object idoptionsObject? (required in case of callback)onSuccessFunction? called on completion with no argument.onErrorFunction? called on fail to load with no argument. Error due to invalid RGB color
Example:
var url = 'https://tailormate3d.com/{instanceName}/texture/{referenceId}';
var options = {};
viewport.loadColorByName(212,112,32,'spread_collar',options,function(){
//Call on success
}, function(error){
//Call on error
});