fix
This commit is contained in:
parent
6a6f135b61
commit
983686d96c
|
@ -27,4 +27,5 @@ const (
|
|||
WEBSOCKET_RENDER_IMAGE Websocket = "WEBSOCKET_RENDER_IMAGE" //图片渲染消息(1级消息,双向通信)
|
||||
WEBSOCKET_RENDER_IMAGE_ERR Websocket = "WEBSOCKET_RENDER_IMAGE_ERR" //图片渲染失败消息(1级消息,单向通信)
|
||||
WEBSOCKET_COMBINE_IMAGE Websocket = "WEBSOCKET_COMBINE_IMAGE" //反回合成刀版图消息(2级消息,单向通信,属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
|
||||
WEBSOCKET_SEND_DATA_TO_UNITY Websocket = "WEBSOCKET_SEND_DATA_TO_UNITY" //发送到unity进行渲染
|
||||
)
|
||||
|
|
|
@ -48,6 +48,7 @@ type renderTask struct {
|
|||
uploadUnityRenderImageTakesTime int64 //上传unity渲染结果图时间
|
||||
}
|
||||
|
||||
// 处理分发到这里的数据
|
||||
func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
||||
logx.Info("收到渲染任务消息:", string(data))
|
||||
select {
|
||||
|
@ -250,14 +251,14 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
},
|
||||
})
|
||||
//组装数据
|
||||
if err = w.assembleRenderData(taskId, combineImage, renderImageData, productTemplate, model3dInfo, element, productSize); err != nil {
|
||||
if err = w.assembleRenderDataToUnity(taskId, combineImage, renderImageData, productTemplate, model3dInfo, element, productSize); err != nil {
|
||||
logx.Error("组装数据失败:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 组装数据发送给unity
|
||||
func (w *wsConnectItem) assembleRenderData(taskId string, combineImage string, info websocket_data.RenderImageReqMsg, productTemplate *gmodel.FsProductTemplateV2, model3dInfo *gmodel.FsProductModel3d, element *gmodel.FsProductTemplateElement, productSize *gmodel.FsProductSize) (err error) {
|
||||
func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage string, info websocket_data.RenderImageReqMsg, productTemplate *gmodel.FsProductTemplateV2, model3dInfo *gmodel.FsProductModel3d, element *gmodel.FsProductTemplateElement, productSize *gmodel.FsProductSize) (err error) {
|
||||
//组装数据
|
||||
refletion := -1
|
||||
if element.Refletion != nil && *element.Refletion != "" {
|
||||
|
@ -358,6 +359,8 @@ func (w *wsConnectItem) assembleRenderData(taskId string, combineImage string, i
|
|||
unityRenderBeginTime: unityRenderBeginTime,
|
||||
},
|
||||
})
|
||||
//发送send 到unity 运行阶段信息
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.ToUnityRspMsg{RenderId: info.RenderId}))
|
||||
logx.Info("发送到unity成功,刀版图:", combineImage /*, " 请求unity的数据:", string(postDataBytes)*/)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
type reuseConnProcessor struct {
|
||||
}
|
||||
|
||||
// 处理分发到这里的数据
|
||||
func (r *reuseConnProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
||||
logx.Info("收到请求恢复上次连接标识数据:", string(data))
|
||||
var wid string
|
||||
|
|
|
@ -51,3 +51,8 @@ type CombineProcessTime struct {
|
|||
CombineTakesTime string `json:"combine_takes_time"` //合图时间
|
||||
UploadCombineImageTakesTime string `json:"upload_combine_image_takes_time"` //上传刀版图耗时
|
||||
}
|
||||
|
||||
// 发送到unity阶段信息返回数据
|
||||
type ToUnityRspMsg struct {
|
||||
RenderId string `json:"render_id"` //渲染id
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user