Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-09-22 14:34:46 +08:00
commit 6fd3bc8a3b

View File

@ -23,7 +23,7 @@ var (
//每个websocket渲染任务缓冲队列长度默认值
renderChanLen = 500
//每个websocket渲染并发数
renderChanConcurrency = 15
renderChanConcurrency = 3
)
// 渲染处理器
@ -33,6 +33,8 @@ type renderProcessor struct {
// 云渲染属性
type extendRenderProperty struct {
renderChan chan websocket_data.RenderImageReqMsg //渲染消息入口的缓冲队列
selectColorIndex int //颜色选中索引
templateTag string //模板标签
}
// 处理分发到这里的数据
@ -48,6 +50,8 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
case <-w.closeChan: //已经关闭
return
case w.extendRenderProperty.renderChan <- renderImageData: //发入到缓冲队列
w.extendRenderProperty.templateTag = renderImageData.RenderData.TemplateTag
w.extendRenderProperty.selectColorIndex = renderImageData.RenderData.TemplateTagColor.SelectedColorIndex
return
}
}
@ -67,6 +71,14 @@ func (w *wsConnectItem) consumeRenderImageData() {
case <-w.closeChan: //已关闭
return
case data := <-w.extendRenderProperty.renderChan: //消费数据
if data.RenderData.TemplateTag != w.extendRenderProperty.templateTag{
logx.Info("由于模板切换了,丢弃该渲染消息")
continue
}
if data.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.selectColorIndex{
logx.Info("由于模板切换了颜色,丢弃该渲染消息")
continue
}
limitChan <- struct{}{}
go func(d websocket_data.RenderImageReqMsg) {
defer func() {
@ -202,6 +214,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
logx.Error("failed to find render resource:", err)
return
}
logx.Info("无缓存的渲染图需要unity")
} else {
//返回给客户端
w.sendRenderResultData(websocket_data.RenderImageRspMsg{