GitHub:https://github.com/BaiFeng3DRE…
详情:https://www.3dreal.com前端
3D Real 开发者工具,能够帮助您开发本身的三维产品展现页面,提供了高度自定义的接口。git
为了保证安全,如下接口须要经过后端接入,而后经过大家自行设计的接口将数据传入到前端,并把数据给到3D前端SDK。github
URL:/api/getAccessToken
Method:GET
后端
queryData:
accessKey: 从API申请页面拿到的accessKey,
accessSecret: 从API申请页面拿到的accessSecretapi
Return:安全
{ // 返回状态码, 0为成功,其余为失败。 code: number, // 错误信息 message: string, // token data: string }
3D Real 开发者工具,能够帮助您开发本身的三维产品展现页面,提供了高度自定义的接口。使用方式以下:工具
<script src="js/threed-real-sdk-1.0.0.js"></script>fetch
var api = new ThreeDRealAPI(token: string); 参数解析: token: 使用 AccessKey 和 AccessSecret 获取的token。
获取私有搭配列表动画
api.fetchScenes() 参数解析: 返回值: Promise<{ id: number, name: string, cover: string }[]>
获取私有模型列表设计
api.fetchScenes() 参数解析: 返回值: Promise<{ id: number, name: string, cover: string }[]>
获取搭配数据,以及三维场景交互控制器。
api.getCollocationView(); 参数解析: 返回值: Promise<{ data: object(如何使用,请看 demo 中的例子), threedViewer: ThreeDRealViewer }[]>
获取模型数据,以及三维场景交互控制器。
api.getModelView(div: HTMLDivElement, id: number, finish?: () => void); 参数解析: 返回值: Promise<{ data: object(如何使用,请看 demo 中的例子), threedViewer: ThreeDRealViewer }[]>
经过上面的接口获取三维视图控制器,对于搭配来讲,咱们能够经过调用如下接口触发模型的变换:
viewer.selectProduct(productIndex: number); 参数解析: productIndex: 当前产品对应的下标. 返回值: undefined 说明: 用于动画切换,若是没有触发动画,请确认后台是否有设置动画操做。
viewer.selectCombination(productIndex: number, combIndex: number); 参数解析: productIndex: 当前产品对应的下标. combIndex: 当前组合的下标. 返回值: undefined 说明: 用于动画切换,若是没有触发动画,请确认后台是否有设置动画操做。
viewer.selectElement(productIndex: number, combIndex: number, pIndex: number, eIndex: number); 参数解析: productIndex: 当前产品对应的下标. combIndex: 当前组合的下标. pIndex: 当前部件的下标. eIndex: 须要切换到的组件的下标. 返回值: Promise
viewer.selectFabric (productIndex: number, combIndex: number, targetFIndex: number); 参数解析: productIndex: 当前产品对应的下标. combIndex: 当前组合的下标. targetFIndex: 须要切换到的面料的下标 返回值: Promise
viewer.destroy()
具体的接入流程能够进入3DREAL众设平台开发文档-接入流程查看。