wonder.js
Version:
194 lines (190 loc) • 13.8 kB
JavaScript
'use strict';
var BufferSettingService$Wonderjs = require("../../../record/main/setting/BufferSettingService.js");
var CopyTransformService$Wonderjs = require("../../../record/main/transform/CopyTransformService.js");
var OperateSettingService$Wonderjs = require("../../../record/main/setting/OperateSettingService.js");
var WorkerDetectMainService$Wonderjs = require("../workerDetect/WorkerDetectMainService.js");
var OperateRenderMainService$Wonderjs = require("./OperateRenderMainService.js");
var PositionLightMainService$Wonderjs = require("../light/PositionLightMainService.js");
var RecordGeometryMainService$Wonderjs = require("../geometry/RecordGeometryMainService.js");
var RecordTransformMainService$Wonderjs = require("../transform/RecordTransformMainService.js");
var RecordPointLightMainService$Wonderjs = require("../light/point/RecordPointLightMainService.js");
var AmbientLightSceneMainService$Wonderjs = require("../scene/AmbientLightSceneMainService.js");
var IndexSourceTextureMainService$Wonderjs = require("../texture/source/IndexSourceTextureMainService.js");
var PositionPointLightMainService$Wonderjs = require("../light/point/PositionPointLightMainService.js");
var RecordMeshRendererMainService$Wonderjs = require("../meshRenderer/RecordMeshRendererMainService.js");
var RecordBasicMaterialMainService$Wonderjs = require("../material/basic/RecordBasicMaterialMainService.js");
var RecordLightMaterialMainService$Wonderjs = require("../material/light/RecordLightMaterialMainService.js");
var OperateSourceTextureMainService$Wonderjs = require("../texture/source/OperateSourceTextureMainService.js");
var OperateTextureRenderMainService$Wonderjs = require("./OperateTextureRenderMainService.js");
var RecordCubemapTextureMainService$Wonderjs = require("../texture/cubemap/RecordCubemapTextureMainService.js");
var RecordDirectionLightMainService$Wonderjs = require("../light/direction/RecordDirectionLightMainService.js");
var RecordSourceInstanceMainService$Wonderjs = require("../instance/RecordSourceInstanceMainService.js");
var RecordRenderLightMaterialService$Wonderjs = require("../../../record/render/material/light/RecordRenderLightMaterialService.js");
var DirectionDirectionLightMainService$Wonderjs = require("../light/direction/DirectionDirectionLightMainService.js");
var RecordBasicSourceTextureMainService$Wonderjs = require("../texture/source/basic_source/RecordBasicSourceTextureMainService.js");
var RecordArrayBufferViewSourceTextureMainService$Wonderjs = require("../texture/source/arrayBufferView_source/RecordArrayBufferViewSourceTextureMainService.js");
function createRenderState(state) {
var settingRecord = state[/* settingRecord */0];
var transformRecord = RecordTransformMainService$Wonderjs.getRecord(state);
var localToWorldMatrices = transformRecord[/* localToWorldMatrices */2];
var localToWorldMatrixCacheMap = transformRecord[/* localToWorldMatrixCacheMap */19];
var normalMatrixCacheMap = transformRecord[/* normalMatrixCacheMap */20];
var geometryRecord = RecordGeometryMainService$Wonderjs.getRecord(state);
var basicMaterialRecord = RecordBasicMaterialMainService$Wonderjs.getRecord(state);
var lightMaterialRecord = RecordLightMaterialMainService$Wonderjs.getRecord(state);
var directionLightRecord = RecordDirectionLightMainService$Wonderjs.getRecord(state);
var pointLightRecord = RecordPointLightMainService$Wonderjs.getRecord(state);
var meshRendererRecord = RecordMeshRendererMainService$Wonderjs.getRecord(state);
var basicSourceTextureRecord = RecordBasicSourceTextureMainService$Wonderjs.getRecord(state);
var arrayBufferViewSourceTextureRecord = RecordArrayBufferViewSourceTextureMainService$Wonderjs.getRecord(state);
var cubemapTextureRecord = RecordCubemapTextureMainService$Wonderjs.getRecord(state);
var sourceInstanceRecord = RecordSourceInstanceMainService$Wonderjs.getRecord(state);
var isUseWorker = WorkerDetectMainService$Wonderjs.isUseWorker(state);
var renderStateTransformRecord = isUseWorker ? /* record */[
/* localToWorldMatrices */CopyTransformService$Wonderjs.unsafeGetCopiedLocalToWorldMatrices(transformRecord),
/* localToWorldMatrixCacheMap */localToWorldMatrixCacheMap,
/* normalMatrixCacheMap */normalMatrixCacheMap
] : /* record */[
/* localToWorldMatrices */localToWorldMatrices,
/* localToWorldMatrixCacheMap */localToWorldMatrixCacheMap,
/* normalMatrixCacheMap */normalMatrixCacheMap
];
return /* record */[
/* sceneRecord : record */[/* ambientLight : record */[/* color */AmbientLightSceneMainService$Wonderjs.getAmbientLightColor(state)]],
/* vboBufferRecord */state[/* vboBufferRecord */36],
/* typeArrayPoolRecord */state[/* typeArrayPoolRecord */38],
/* glslSenderRecord */state[/* glslSenderRecord */32],
/* programRecord */state[/* programRecord */30],
/* geometryRecord : record */[
/* vertices */geometryRecord[/* vertices */2],
/* texCoords */geometryRecord[/* texCoords */3],
/* normals */geometryRecord[/* normals */4],
/* indices16 */geometryRecord[/* indices16 */5],
/* indices32 */geometryRecord[/* indices32 */6],
/* verticesInfos */geometryRecord[/* verticesInfos */7],
/* texCoordsInfos */geometryRecord[/* texCoordsInfos */8],
/* normalsInfos */geometryRecord[/* normalsInfos */9],
/* indicesInfos */geometryRecord[/* indicesInfos */10],
/* indicesTypeMap */geometryRecord[/* indicesTypeMap */17]
],
/* cameraRecord */OperateRenderMainService$Wonderjs.getCameraRecord(state),
/* basicMaterialRecord : record */[
/* shaderIndices */basicMaterialRecord[/* shaderIndices */2],
/* colors */basicMaterialRecord[/* colors */3],
/* isDepthTests */basicMaterialRecord[/* isDepthTests */4],
/* alphas */basicMaterialRecord[/* alphas */5]
],
/* lightMaterialRecord : record */[
/* diffuseMapUnitMap */RecordRenderLightMaterialService$Wonderjs.createDiffuseMapUnitMap(/* () */0),
/* specularMapUnitMap */RecordRenderLightMaterialService$Wonderjs.createSpecularMapUnitMap(/* () */0),
/* shaderIndices */lightMaterialRecord[/* shaderIndices */2],
/* diffuseColors */lightMaterialRecord[/* diffuseColors */3],
/* specularColors */lightMaterialRecord[/* specularColors */4],
/* shininess */lightMaterialRecord[/* shininess */5],
/* diffuseTextureIndices */lightMaterialRecord[/* diffuseTextureIndices */6],
/* specularTextureIndices */lightMaterialRecord[/* specularTextureIndices */7]
],
/* meshRendererRecord : record */[/* drawModes */meshRendererRecord[/* drawModes */2]],
/* basicSourceTextureRecord : record */[
/* wrapSs */basicSourceTextureRecord[/* wrapSs */1],
/* wrapTs */basicSourceTextureRecord[/* wrapTs */2],
/* magFilters */basicSourceTextureRecord[/* magFilters */3],
/* minFilters */basicSourceTextureRecord[/* minFilters */4],
/* formats */basicSourceTextureRecord[/* formats */5],
/* types */basicSourceTextureRecord[/* types */6],
/* isNeedUpdates */basicSourceTextureRecord[/* isNeedUpdates */7],
/* flipYs */basicSourceTextureRecord[/* flipYs */8],
/* sourceMap */basicSourceTextureRecord[/* sourceMap */9],
/* glTextureMap */basicSourceTextureRecord[/* glTextureMap */10],
/* setFlipYFunc */OperateSourceTextureMainService$Wonderjs.setFlipY
],
/* arrayBufferViewSourceTextureRecord : record */[
/* wrapSs */arrayBufferViewSourceTextureRecord[/* wrapSs */1],
/* wrapTs */arrayBufferViewSourceTextureRecord[/* wrapTs */2],
/* magFilters */arrayBufferViewSourceTextureRecord[/* magFilters */3],
/* minFilters */arrayBufferViewSourceTextureRecord[/* minFilters */4],
/* formats */arrayBufferViewSourceTextureRecord[/* formats */5],
/* types */arrayBufferViewSourceTextureRecord[/* types */6],
/* isNeedUpdates */arrayBufferViewSourceTextureRecord[/* isNeedUpdates */7],
/* flipYs */arrayBufferViewSourceTextureRecord[/* flipYs */8],
/* widths */arrayBufferViewSourceTextureRecord[/* widths */9],
/* heights */arrayBufferViewSourceTextureRecord[/* heights */10],
/* sourceMap */arrayBufferViewSourceTextureRecord[/* sourceMap */11],
/* glTextureMap */arrayBufferViewSourceTextureRecord[/* glTextureMap */12],
/* setFlipYFunc */OperateSourceTextureMainService$Wonderjs.setFlipY,
/* textureIndexOffset */IndexSourceTextureMainService$Wonderjs.getArrayBufferViewSourceTextureIndexOffset(state)
],
/* cubemapTextureRecord : record */[
/* wrapSs */cubemapTextureRecord[/* wrapSs */2],
/* wrapTs */cubemapTextureRecord[/* wrapTs */3],
/* magFilters */cubemapTextureRecord[/* magFilters */4],
/* minFilters */cubemapTextureRecord[/* minFilters */5],
/* pxFormats */cubemapTextureRecord[/* pxFormats */6],
/* nxFormats */cubemapTextureRecord[/* nxFormats */7],
/* pyFormats */cubemapTextureRecord[/* pyFormats */8],
/* nyFormats */cubemapTextureRecord[/* nyFormats */9],
/* pzFormats */cubemapTextureRecord[/* pzFormats */10],
/* nzFormats */cubemapTextureRecord[/* nzFormats */11],
/* pxTypes */cubemapTextureRecord[/* pxTypes */12],
/* nxTypes */cubemapTextureRecord[/* nxTypes */13],
/* pyTypes */cubemapTextureRecord[/* pyTypes */14],
/* nyTypes */cubemapTextureRecord[/* nyTypes */15],
/* pzTypes */cubemapTextureRecord[/* pzTypes */16],
/* nzTypes */cubemapTextureRecord[/* nzTypes */17],
/* isNeedUpdates */cubemapTextureRecord[/* isNeedUpdates */18],
/* flipYs */cubemapTextureRecord[/* flipYs */19],
/* pxSourceMap */cubemapTextureRecord[/* pxSourceMap */20],
/* nxSourceMap */cubemapTextureRecord[/* nxSourceMap */21],
/* pySourceMap */cubemapTextureRecord[/* pySourceMap */22],
/* nySourceMap */cubemapTextureRecord[/* nySourceMap */23],
/* pzSourceMap */cubemapTextureRecord[/* pzSourceMap */24],
/* nzSourceMap */cubemapTextureRecord[/* nzSourceMap */25],
/* glTextureMap */cubemapTextureRecord[/* glTextureMap */26],
/* setFlipYFunc */OperateSourceTextureMainService$Wonderjs.setFlipY
],
/* allTextureRecord : record */[
/* activableTextureUnitArray */OperateTextureRenderMainService$Wonderjs.getActivableTextureUnitArray(state),
/* activedTextureUnitIndex */0
],
/* directionLightRecord : record */[
/* index */directionLightRecord[/* index */0],
/* colors */directionLightRecord[/* colors */2],
/* intensities */directionLightRecord[/* intensities */3],
/* renderLightArr */directionLightRecord[/* renderLightArr */4],
/* directionMap */DirectionDirectionLightMainService$Wonderjs.buildDirectionMap(DirectionDirectionLightMainService$Wonderjs.getDirection, state)
],
/* pointLightRecord : record */[
/* index */pointLightRecord[/* index */0],
/* colors */pointLightRecord[/* colors */2],
/* intensities */pointLightRecord[/* intensities */3],
/* constants */pointLightRecord[/* constants */4],
/* linears */pointLightRecord[/* linears */5],
/* quadratics */pointLightRecord[/* quadratics */6],
/* ranges */pointLightRecord[/* ranges */7],
/* renderLightArr */pointLightRecord[/* renderLightArr */8],
/* positionMap */PositionLightMainService$Wonderjs.buildPositionMap(PositionPointLightMainService$Wonderjs.getPosition, state)
],
/* transformRecord */renderStateTransformRecord,
/* sourceInstanceRecord : record */[
/* objectInstanceTransformIndexMap */sourceInstanceRecord[/* objectInstanceTransformIndexMap */1],
/* objectInstanceTransformCollections */sourceInstanceRecord[/* objectInstanceTransformCollections */4],
/* isTransformStatics */sourceInstanceRecord[/* isTransformStatics */3],
/* matrixInstanceBufferCapacityMap */sourceInstanceRecord[/* matrixInstanceBufferCapacityMap */5],
/* matrixFloat32ArrayMap */sourceInstanceRecord[/* matrixFloat32ArrayMap */6],
/* isSendTransformMatrixDataMap */sourceInstanceRecord[/* isSendTransformMatrixDataMap */7]
],
/* gpuDetectRecord */state[/* gpuDetectRecord */5],
/* globalTempRecord */state[/* globalTempRecord */37],
/* deviceManagerRecord */state[/* deviceManagerRecord */9],
/* settingRecord : record */[
/* gpu */OperateSettingService$Wonderjs.unsafeGetGPU(settingRecord),
/* instanceBuffer *//* record */[/* objectInstanceCountPerSourceInstance */BufferSettingService$Wonderjs.getObjectInstanceCountPerSourceInstance(settingRecord)]
],
/* workerDetectRecord : record */[/* isUseWorker */isUseWorker],
/* browserDetectRecord : record */[/* browser */state[/* browserDetectRecord */42][/* browser */0]],
/* jobDataRecord */state[/* jobDataRecord */46],
/* shaderRecord */state[/* shaderRecord */28]
];
}
exports.createRenderState = createRenderState;
/* BufferSettingService-Wonderjs Not a pure module */