@galacean/engine-physics-lite 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +234 -97
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/miniprogram.js
CHANGED
|
@@ -9452,9 +9452,9 @@ function _extends$2() {
|
|
|
9452
9452
|
}
|
|
9453
9453
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
9454
9454
|
var common = "#define GLSLIFY 1\n#define PI 3.14159265359\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n#define LOG2 1.442695\n#define saturate( a ) clamp( a, 0.0, 1.0 )\nfloat pow2(float x){return x*x;}vec4 RGBMToLinear(vec4 value,float maxRange){return vec4(value.rgb*value.a*maxRange,1.0);}vec4 gammaToLinear(vec4 srgbIn){return vec4(pow(srgbIn.rgb,vec3(2.2)),srgbIn.a);}vec4 linearToGamma(vec4 linearIn){return vec4(pow(linearIn.rgb,vec3(1.0/2.2)),linearIn.a);}\n#ifdef GRAPHICS_API_WEBGL2\n#define INVERSE_MAT(mat) inverse(mat)\n#else\nmat2 inverseMat(mat2 m){return mat2(m[1][1],-m[0][1],-m[1][0],m[0][0])/(m[0][0]*m[1][1]-m[0][1]*m[1][0]);}mat3 inverseMat(mat3 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2];float a10=m[1][0],a11=m[1][1],a12=m[1][2];float a20=m[2][0],a21=m[2][1],a22=m[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}mat4 inverseMat(mat4 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;return mat4(a11*b11-a12*b10+a13*b09,a02*b10-a01*b11-a03*b09,a31*b05-a32*b04+a33*b03,a22*b04-a21*b05-a23*b03,a12*b08-a10*b11-a13*b07,a00*b11-a02*b08+a03*b07,a32*b02-a30*b05-a33*b01,a20*b05-a22*b02+a23*b01,a10*b10-a11*b08+a13*b06,a01*b08-a00*b10-a03*b06,a30*b04-a31*b02+a33*b00,a21*b02-a20*b04-a23*b00,a11*b07-a10*b09-a12*b06,a00*b09-a01*b07+a02*b06,a31*b01-a30*b03-a32*b00,a20*b03-a21*b01+a22*b00)/det;}\n#define INVERSE_MAT(mat) inverseMat(mat)\n#endif\n"; // eslint-disable-line
|
|
9455
|
-
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef RENDERER_HAS_UV\nattribute vec2 TEXCOORD_0;\n#endif\n#ifdef RENDERER_HAS_UV1\nattribute vec2 TEXCOORD_1;\n#endif\n#ifdef RENDERER_HAS_SKIN\nattribute vec4 JOINTS_0;attribute vec4 WEIGHTS_0;\n#ifdef RENDERER_USE_JOINT_TEXTURE\nuniform sampler2D renderer_JointSampler;uniform float renderer_JointCount;mat4 getJointMatrix(sampler2D smp,float index){float base=index/renderer_JointCount;float hf=0.5/renderer_JointCount;float v=base+hf;vec4 m0=texture2D(smp,vec2(0.125,v));vec4 m1=texture2D(smp,vec2(0.375,v));vec4 m2=texture2D(smp,vec2(0.625,v));vec4 m3=texture2D(smp,vec2(0.875,v));return mat4(m0,m1,m2,m3);}\n#else\nuniform mat4 renderer_JointMatrix[RENDERER_JOINTS_NUM];\n#endif\n#endif\n#ifdef
|
|
9455
|
+
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef RENDERER_HAS_UV\nattribute vec2 TEXCOORD_0;\n#endif\n#ifdef RENDERER_HAS_UV1\nattribute vec2 TEXCOORD_1;\n#endif\n#ifdef RENDERER_HAS_SKIN\nattribute vec4 JOINTS_0;attribute vec4 WEIGHTS_0;\n#ifdef RENDERER_USE_JOINT_TEXTURE\nuniform sampler2D renderer_JointSampler;uniform float renderer_JointCount;mat4 getJointMatrix(sampler2D smp,float index){float base=index/renderer_JointCount;float hf=0.5/renderer_JointCount;float v=base+hf;vec4 m0=texture2D(smp,vec2(0.125,v));vec4 m1=texture2D(smp,vec2(0.375,v));vec4 m2=texture2D(smp,vec2(0.625,v));vec4 m3=texture2D(smp,vec2(0.875,v));return mat4(m0,m1,m2,m3);}\n#else\nuniform mat4 renderer_JointMatrix[RENDERER_JOINTS_NUM];\n#endif\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nattribute vec4 COLOR_0;\n#endif\n#include <transform_declare>\n#include <camera_declare>\nuniform vec4 material_TilingOffset;\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nattribute vec3 NORMAL;\n#endif\n#ifdef RENDERER_HAS_TANGENT\nattribute vec4 TANGENT;\n#endif\n#endif\n"; // eslint-disable-line
|
|
9456
9456
|
var transform_declare = "#define GLSLIFY 1\nuniform mat4 renderer_LocalMat;uniform mat4 renderer_ModelMat;uniform mat4 camera_ViewMat;uniform mat4 camera_ProjMat;uniform mat4 renderer_MVMat;uniform mat4 renderer_MVPMat;uniform mat4 renderer_NormalMat;"; // eslint-disable-line
|
|
9457
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9457
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9458
9458
|
var FogFragmentDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;uniform vec4 scene_FogColor;uniform vec4 scene_FogParams;float ComputeFogIntensity(float fogDepth){\n#if SCENE_FOG_MODE == 1\nreturn clamp(fogDepth*scene_FogParams.x+scene_FogParams.y,0.0,1.0);\n#elif SCENE_FOG_MODE == 2\nreturn clamp(exp2(-fogDepth*scene_FogParams.z),0.0,1.0);\n#elif SCENE_FOG_MODE == 3\nfloat factor=fogDepth*scene_FogParams.w;return clamp(exp2(-factor*factor),0.0,1.0);\n#endif\n}\n#endif\n"; // eslint-disable-line
|
|
9459
9459
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
9460
9460
|
var normal_share = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvarying vec3 v_normal;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvarying mat3 v_TBN;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
@@ -9464,7 +9464,7 @@ var begin_normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef
|
|
|
9464
9464
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
9465
9465
|
var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nuniform mediump sampler2DArray renderer_BlendShapeTexture;uniform ivec3 renderer_BlendShapeTextureInfo;uniform float renderer_BlendShapeWeights[RENDERER_BLENDSHAPE_COUNT];\n#else\nattribute vec3 POSITION_BS0;attribute vec3 POSITION_BS1;\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;uniform float renderer_BlendShapeWeights[2];\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;\n#ifdef RENDERER_BLENDSHAPE_HAS_NORMAL\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 NORMAL_BS2;attribute vec3 NORMAL_BS3;\n#endif\n#ifdef RENDERER_BLENDSHAPE_HAS_TANGENT\nattribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;attribute vec3 TANGENT_BS2;attribute vec3 TANGENT_BS3;\n#endif\nuniform float renderer_BlendShapeWeights[4];\n#else\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;attribute vec3 POSITION_BS4;attribute vec3 POSITION_BS5;attribute vec3 POSITION_BS6;attribute vec3 POSITION_BS7;uniform float renderer_BlendShapeWeights[8];\n#endif\n#endif\n#endif\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nvec3 getBlendShapeVertexElement(int blendShapeIndex,int vertexElementIndex){int y=vertexElementIndex/renderer_BlendShapeTextureInfo.y;int x=vertexElementIndex-y*renderer_BlendShapeTextureInfo.y;ivec3 uv=ivec3(x,y,blendShapeIndex);return texelFetch(renderer_BlendShapeTexture,uv,0).xyz;}\n#endif\n#endif\n"; // eslint-disable-line
|
|
9466
9466
|
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9467
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9467
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9468
9468
|
var FogVertex = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvec4 positionVS=renderer_MVMat*position;v_positionVS=positionVS.xyz/positionVS.w;\n#endif\n"; // eslint-disable-line
|
|
9469
9469
|
var normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nv_normal=normalize(mat3(renderer_NormalMat)*normal);\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvec3 normalW=normalize(mat3(renderer_NormalMat)*normal.xyz);vec3 tangentW=normalize(mat3(renderer_NormalMat)*tangent.xyz);vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9470
9470
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
@@ -9474,7 +9474,7 @@ var worldpos_vert = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec4 tem
|
|
|
9474
9474
|
var FogFragment = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nfloat fogIntensity=ComputeFogIntensity(length(v_positionVS));gl_FragColor.rgb=mix(scene_FogColor.rgb,gl_FragColor.rgb,fogIntensity);\n#endif\n"; // eslint-disable-line
|
|
9475
9475
|
var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstruct DirectLight{vec3 color;vec3 direction;};uniform ivec2 scene_DirectLightCullingMask[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightColor[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightDirection[SCENE_DIRECT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nstruct PointLight{vec3 color;vec3 position;float distance;};uniform ivec2 scene_PointLightCullingMask[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightColor[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightPosition[SCENE_POINT_LIGHT_COUNT];uniform float scene_PointLightDistance[SCENE_POINT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nstruct SpotLight{vec3 color;vec3 position;vec3 direction;float distance;float angleCos;float penumbraCos;};uniform ivec2 scene_SpotLightCullingMask[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightColor[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightPosition[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightDirection[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightDistance[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightAngleCos[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightPenumbraCos[SCENE_SPOT_LIGHT_COUNT];\n#endif\nstruct EnvMapLight{vec3 diffuse;float mipMapLevel;float diffuseIntensity;float specularIntensity;};uniform EnvMapLight scene_EnvMapLight;uniform ivec4 renderer_Layer;\n#ifdef SCENE_USE_SH\nuniform vec3 scene_EnvSH[9];\n#endif\n#ifdef SCENE_USE_SPECULAR_ENV\nuniform samplerCube scene_EnvSpecularSampler;\n#endif\n#ifndef GRAPHICS_API_WEBGL2\nbool isBitSet(float value,float mask,float bitIndex){return mod(floor(value/pow(2.0,bitIndex)),2.0)==1.0&&mod(floor(mask/pow(2.0,bitIndex)),2.0)==1.0;}\n#endif\nbool isRendererCulledByLight(ivec2 rendererLayer,ivec2 lightCullingMask){\n#ifdef GRAPHICS_API_WEBGL2\nreturn!((rendererLayer.x&lightCullingMask.x)!=0||(rendererLayer.y&lightCullingMask.y)!=0);\n#else\nfor(int i=0;i<16;i++){if(isBitSet(float(rendererLayer.x),float(lightCullingMask.x),float(i))||isBitSet(float(rendererLayer.y),float(lightCullingMask.y),float(i))){return false;}}return true;\n#endif\n}"; // eslint-disable-line
|
|
9476
9476
|
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveColor;uniform vec4 material_BaseColor;uniform vec4 material_SpecularColor;uniform float material_Shininess;uniform float material_NormalIntensity;uniform float material_AlphaCutoff;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nuniform sampler2D material_SpecularTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n"; // eslint-disable-line
|
|
9477
|
-
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef
|
|
9477
|
+
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\ndiffuse*=v_color;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nvec4 specularTextureColor=texture2D(material_SpecularTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularTextureColor=gammaToLinear(specularTextureColor);\n#endif\nspecular*=specularTextureColor;\n#endif\nambient=vec4(scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity,1.0)*diffuse;"; // eslint-disable-line
|
|
9478
9478
|
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
9479
9479
|
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN();vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\nvec3 N=getNormal();\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
9480
9480
|
var noise_cellular = "#define GLSLIFY 1\n#include <noise_cellular_2D>\n#include <noise_cellular_3D>\n#include <noise_cellular_2x2>\n#include <noise_cellular_2x2x2>\n"; // eslint-disable-line
|
|
@@ -9494,7 +9494,7 @@ var noise_simplex_3D = "#define GLSLIFY 1\nfloat simplex(vec3 v){const vec2 C=ve
|
|
|
9494
9494
|
var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gradient){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);vec4 m2=m*m;vec4 m4=m2*m2;vec4 pdotx=vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3));vec4 temp=m2*m*pdotx;gradient=-8.0*(temp.x*x0+temp.y*x1+temp.z*x2+temp.w*x3);gradient+=m4.x*p0+m4.y*p1+m4.z*p2+m4.w*p3;gradient*=42.0;return 42.0*dot(m4,pdotx);}"; // eslint-disable-line
|
|
9495
9495
|
var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}\n#define F4 0.309016994374947451\nfloat simplex(vec4 v){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v+dot(v,vec4(F4)));vec4 x0=v-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 m0=max(0.6-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.6-vec2(dot(x3,x3),dot(x4,x4)),0.0);m0=m0*m0;m1=m1*m1;return 49.0*(dot(m0*m0,vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2)))+dot(m1*m1,vec2(dot(p3,x3),dot(p4,x4))));}"; // eslint-disable-line
|
|
9496
9496
|
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform float material_IOR;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#endif\nuniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\nuniform sampler2D material_ClearCoatNormalTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
9497
|
-
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.clearCoatNormal=getNormal();\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float F0=pow2((material_IOR-1.0)/(material_IOR+1.0));\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef
|
|
9497
|
+
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.clearCoatNormal=getNormal();\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float F0=pow2((material_IOR-1.0)/(material_IOR+1.0));\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(F0),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(material.roughness,getAARoughnessFactor(geometry.normal));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
|
|
9498
9498
|
var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float dotLH){return 0.04+0.96*(pow(1.0-dotLH,5.0));}vec3 F_Schlick(vec3 specularColor,float dotLH){float fresnel=exp2((-5.55473*dotLH-6.98316)*dotLH);return(1.0-specularColor)*fresnel+specularColor;}float G_GGX_SmithCorrelated(float alpha,float dotNL,float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}float D_GGX(float alpha,float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);}vec3 BRDF_Specular_GGX(vec3 incidentDirection,vec3 viewDir,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));vec3 F=F_Schlick(specularColor,dotLH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(G*D);}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
|
|
9499
9499
|
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(geometry.clearCoatDotNV);\n#endif\nfloat dotNL=saturate(dot(geometry.normal,incidentDirection));vec3 irradiance=dotNL*color*PI;reflectedLight.directSpecular+=attenuation*irradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nvoid addDirectionalDirectLightRadiance(DirectLight directionalLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 color=directionalLight.color;vec3 direction=-directionalLight.direction;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nvoid addPointDirectLightRadiance(PointLight pointLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=pointLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);vec3 color=pointLight.color;color*=clamp(1.0-pow(lightDistance/pointLight.distance,4.0),0.0,1.0);addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nvoid addSpotDirectLightRadiance(SpotLight spotLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=spotLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);float angleCos=dot(direction,-spotLight.direction);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayEffect=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);vec3 color=spotLight.color;color*=spotEffect*decayEffect;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\nvoid addTotalDirectRadiance(Geometry geometry,Material material,inout ReflectedLight reflectedLight){float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}\n#endif\n}"; // eslint-disable-line
|
|
9500
9500
|
var ibl_frag_define = "#define GLSLIFY 1\nvec3 getLightProbeIrradiance(vec3 sh[9],vec3 normal){normal.x=-normal.x;vec3 result=sh[0]+sh[1]*(normal.y)+sh[2]*(normal.z)+sh[3]*(normal.x)+sh[4]*(normal.y*normal.x)+sh[5]*(normal.y*normal.z)+sh[6]*(3.0*normal.z*normal.z-1.0)+sh[7]*(normal.z*normal.x)+sh[8]*(normal.x*normal.x-normal.y*normal.y);return max(result,vec3(0.0));}vec3 envBRDFApprox(vec3 specularColor,float roughness,float dotNV){const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}float getSpecularMIPLevel(float roughness,int maxMIPLevel){return roughness*float(maxMIPLevel);}vec3 getLightProbeRadiance(vec3 viewDir,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec.x=-reflectVec.x;float specularMIPLevel=getSpecularMIPLevel(roughness,maxMIPLevel);\n#ifdef HAS_TEX_LOD\nvec4 envMapColor=textureCubeLodEXT(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#else\nvec4 envMapColor=textureCube(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#endif\n#ifdef SCENE_IS_DECODE_ENV_RGBM\nenvMapColor.rgb=RGBMToLinear(envMapColor,5.0).rgb;\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=linearToGamma(envMapColor);\n#endif\n#else\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=gammaToLinear(envMapColor);\n#endif\n#endif\nreturn envMapColor.rgb*specularIntensity;\n#endif\n}"; // eslint-disable-line
|
|
@@ -11036,8 +11036,10 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11036
11036
|
_this = Renderer.call(this, entity) || this;
|
|
11037
11037
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
11038
11038
|
_this._sprite = null;
|
|
11039
|
-
_this.
|
|
11040
|
-
_this.
|
|
11039
|
+
_this._automaticWidth = 0;
|
|
11040
|
+
_this._automaticHeight = 0;
|
|
11041
|
+
_this._customWidth = undefined;
|
|
11042
|
+
_this._customHeight = undefined;
|
|
11041
11043
|
_this._flipX = false;
|
|
11042
11044
|
_this._flipY = false;
|
|
11043
11045
|
_this._alphaCutoff = 0.5;
|
|
@@ -11057,12 +11059,11 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11057
11059
|
/**
|
|
11058
11060
|
* @internal
|
|
11059
11061
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
+
if (this.sprite) {
|
|
11063
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
11064
|
+
} else {
|
|
11062
11065
|
worldBounds.min.set(0, 0, 0);
|
|
11063
11066
|
worldBounds.max.set(0, 0, 0);
|
|
11064
|
-
} else {
|
|
11065
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
11066
11067
|
}
|
|
11067
11068
|
};
|
|
11068
11069
|
/**
|
|
@@ -11073,12 +11074,12 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11073
11074
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11074
11075
|
return;
|
|
11075
11076
|
}
|
|
11076
|
-
// Update position
|
|
11077
|
+
// Update position
|
|
11077
11078
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
11078
11079
|
SimpleSpriteAssembler.updatePositions(this);
|
|
11079
11080
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
11080
11081
|
}
|
|
11081
|
-
// Update uv
|
|
11082
|
+
// Update uv
|
|
11082
11083
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
11083
11084
|
SimpleSpriteAssembler.updateUVs(this);
|
|
11084
11085
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -11101,11 +11102,27 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11101
11102
|
this._sprite = null;
|
|
11102
11103
|
this._verticesData = null;
|
|
11103
11104
|
};
|
|
11105
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
11106
|
+
var sprite = this._sprite;
|
|
11107
|
+
if (sprite) {
|
|
11108
|
+
this._automaticWidth = sprite.width;
|
|
11109
|
+
this._automaticHeight = sprite.height;
|
|
11110
|
+
} else {
|
|
11111
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
11112
|
+
}
|
|
11113
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
11114
|
+
};
|
|
11104
11115
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
11105
11116
|
switch(type){
|
|
11106
11117
|
case SpriteModifyFlags.texture:
|
|
11107
11118
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
11108
11119
|
break;
|
|
11120
|
+
case SpriteModifyFlags.size:
|
|
11121
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
11122
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
11123
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11124
|
+
}
|
|
11125
|
+
break;
|
|
11109
11126
|
case SpriteModifyFlags.region:
|
|
11110
11127
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
11111
11128
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -11113,22 +11130,31 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11113
11130
|
case SpriteModifyFlags.atlasRegion:
|
|
11114
11131
|
this._dirtyUpdateFlag |= 0x2;
|
|
11115
11132
|
break;
|
|
11133
|
+
case SpriteModifyFlags.pivot:
|
|
11134
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11135
|
+
break;
|
|
11116
11136
|
}
|
|
11117
11137
|
};
|
|
11118
11138
|
_create_class$2(SpriteMask, [
|
|
11119
11139
|
{
|
|
11120
11140
|
key: "width",
|
|
11121
11141
|
get: /**
|
|
11122
|
-
* Render width.
|
|
11142
|
+
* Render width (in world coordinates).
|
|
11143
|
+
*
|
|
11144
|
+
* @remarks
|
|
11145
|
+
* If width is set, return the set value,
|
|
11146
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
11123
11147
|
*/ function get() {
|
|
11124
|
-
if (this.
|
|
11125
|
-
|
|
11148
|
+
if (this._customWidth !== undefined) {
|
|
11149
|
+
return this._customWidth;
|
|
11150
|
+
} else {
|
|
11151
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11152
|
+
return this._automaticWidth;
|
|
11126
11153
|
}
|
|
11127
|
-
return this._width;
|
|
11128
11154
|
},
|
|
11129
11155
|
set: function set(value) {
|
|
11130
|
-
if (this.
|
|
11131
|
-
this.
|
|
11156
|
+
if (this._customWidth !== value) {
|
|
11157
|
+
this._customWidth = value;
|
|
11132
11158
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11133
11159
|
}
|
|
11134
11160
|
}
|
|
@@ -11136,16 +11162,22 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11136
11162
|
{
|
|
11137
11163
|
key: "height",
|
|
11138
11164
|
get: /**
|
|
11139
|
-
* Render height.
|
|
11165
|
+
* Render height (in world coordinates).
|
|
11166
|
+
*
|
|
11167
|
+
* @remarks
|
|
11168
|
+
* If height is set, return the set value,
|
|
11169
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
11140
11170
|
*/ function get() {
|
|
11141
|
-
if (this.
|
|
11142
|
-
|
|
11171
|
+
if (this._customHeight !== undefined) {
|
|
11172
|
+
return this._customHeight;
|
|
11173
|
+
} else {
|
|
11174
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11175
|
+
return this._automaticHeight;
|
|
11143
11176
|
}
|
|
11144
|
-
return this._height;
|
|
11145
11177
|
},
|
|
11146
11178
|
set: function set(value) {
|
|
11147
|
-
if (this.
|
|
11148
|
-
this.
|
|
11179
|
+
if (this._customHeight !== value) {
|
|
11180
|
+
this._customHeight = value;
|
|
11149
11181
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11150
11182
|
}
|
|
11151
11183
|
}
|
|
@@ -11189,9 +11221,9 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11189
11221
|
var lastSprite = this._sprite;
|
|
11190
11222
|
if (lastSprite !== value) {
|
|
11191
11223
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11224
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
11192
11225
|
if (value) {
|
|
11193
11226
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
11194
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
11195
11227
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
11196
11228
|
} else {
|
|
11197
11229
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -11231,10 +11263,16 @@ __decorate$1([
|
|
|
11231
11263
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
11232
11264
|
__decorate$1([
|
|
11233
11265
|
ignoreClone
|
|
11234
|
-
], SpriteMask.prototype, "
|
|
11266
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
11235
11267
|
__decorate$1([
|
|
11236
11268
|
ignoreClone
|
|
11237
|
-
], SpriteMask.prototype, "
|
|
11269
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
11270
|
+
__decorate$1([
|
|
11271
|
+
assignmentClone
|
|
11272
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
11273
|
+
__decorate$1([
|
|
11274
|
+
assignmentClone
|
|
11275
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
11238
11276
|
__decorate$1([
|
|
11239
11277
|
assignmentClone
|
|
11240
11278
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -11252,7 +11290,9 @@ var /**
|
|
|
11252
11290
|
*/ SpriteMaskUpdateFlags;
|
|
11253
11291
|
(function(SpriteMaskUpdateFlags) {
|
|
11254
11292
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
11255
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
11293
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
11294
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
11295
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
11256
11296
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
11257
11297
|
/**
|
|
11258
11298
|
* Vertex element format.
|
|
@@ -12045,6 +12085,7 @@ var MeshModifyFlags;
|
|
|
12045
12085
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
12046
12086
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
12047
12087
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
12088
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
12048
12089
|
// @todo: should fix bug when dataChangedFlag is true
|
|
12049
12090
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
12050
12091
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -12062,7 +12103,7 @@ var MeshModifyFlags;
|
|
|
12062
12103
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
12063
12104
|
var storeInfo = storeInfos[i];
|
|
12064
12105
|
storeInfo || (storeInfos[i] = storeInfo = new miniprogram$7.Vector2());
|
|
12065
|
-
storeInfo.set(
|
|
12106
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
12066
12107
|
var deltaPositions = endFrame.deltaPositions;
|
|
12067
12108
|
for(var j = 0; j < vertexCount; j++){
|
|
12068
12109
|
var start = offset + bufferFloatStride * j;
|
|
@@ -13334,6 +13375,7 @@ var VertexChangedFlags;
|
|
|
13334
13375
|
var MeshRenderer = function MeshRenderer(entity) {
|
|
13335
13376
|
var _this;
|
|
13336
13377
|
_this = Renderer.call(this, entity) || this;
|
|
13378
|
+
_this._enableVertexColor = false;
|
|
13337
13379
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13338
13380
|
return _this;
|
|
13339
13381
|
};
|
|
@@ -13379,7 +13421,7 @@ var VertexChangedFlags;
|
|
|
13379
13421
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13380
13422
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13381
13423
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13382
|
-
shaderData.disableMacro(MeshRenderer.
|
|
13424
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13383
13425
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13384
13426
|
switch(vertexElements[i].semantic){
|
|
13385
13427
|
case "TEXCOORD_0":
|
|
@@ -13395,7 +13437,7 @@ var VertexChangedFlags;
|
|
|
13395
13437
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13396
13438
|
break;
|
|
13397
13439
|
case "COLOR_0":
|
|
13398
|
-
shaderData.enableMacro(MeshRenderer.
|
|
13440
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13399
13441
|
break;
|
|
13400
13442
|
}
|
|
13401
13443
|
}
|
|
@@ -13446,6 +13488,20 @@ var VertexChangedFlags;
|
|
|
13446
13488
|
this._setMesh(value);
|
|
13447
13489
|
}
|
|
13448
13490
|
}
|
|
13491
|
+
},
|
|
13492
|
+
{
|
|
13493
|
+
key: "enableVertexColor",
|
|
13494
|
+
get: /**
|
|
13495
|
+
* Whether enable vertex color.
|
|
13496
|
+
*/ function get() {
|
|
13497
|
+
return this._enableVertexColor;
|
|
13498
|
+
},
|
|
13499
|
+
set: function set(value) {
|
|
13500
|
+
if (value !== this._enableVertexColor) {
|
|
13501
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13502
|
+
this._enableVertexColor = value;
|
|
13503
|
+
}
|
|
13504
|
+
}
|
|
13449
13505
|
}
|
|
13450
13506
|
]);
|
|
13451
13507
|
return MeshRenderer;
|
|
@@ -13463,7 +13519,7 @@ var VertexChangedFlags;
|
|
|
13463
13519
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13464
13520
|
})();
|
|
13465
13521
|
(function() {
|
|
13466
|
-
MeshRenderer.
|
|
13522
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
13467
13523
|
})();
|
|
13468
13524
|
__decorate$1([
|
|
13469
13525
|
ignoreClone
|
|
@@ -15040,7 +15096,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
15040
15096
|
// vertices
|
|
15041
15097
|
this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
15042
15098
|
// indices
|
|
15043
|
-
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
|
|
15099
|
+
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
|
|
15044
15100
|
mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
|
|
15045
15101
|
mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
|
|
15046
15102
|
mesh.setVertexElements(vertexElements);
|
|
@@ -18114,7 +18170,7 @@ var /**
|
|
|
18114
18170
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
18115
18171
|
})();
|
|
18116
18172
|
(function() {
|
|
18117
|
-
CascadedShadowCasterPass._viewport = new miniprogram$7.
|
|
18173
|
+
CascadedShadowCasterPass._viewport = new miniprogram$7.Vector4(0, 0, 1, 1);
|
|
18118
18174
|
})();
|
|
18119
18175
|
(function() {
|
|
18120
18176
|
CascadedShadowCasterPass._clearColor = new miniprogram$7.Color(1, 1, 1, 1);
|
|
@@ -20160,8 +20216,10 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20160
20216
|
if (name === void 0) name = null;
|
|
20161
20217
|
var _this;
|
|
20162
20218
|
_this = ReferResource.call(this, engine) || this;
|
|
20163
|
-
_this.
|
|
20164
|
-
_this.
|
|
20219
|
+
_this._automaticWidth = 0;
|
|
20220
|
+
_this._automaticHeight = 0;
|
|
20221
|
+
_this._customWidth = undefined;
|
|
20222
|
+
_this._customHeight = undefined;
|
|
20165
20223
|
_this._positions = [
|
|
20166
20224
|
new miniprogram$7.Vector2(),
|
|
20167
20225
|
new miniprogram$7.Vector2(),
|
|
@@ -20182,7 +20240,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20182
20240
|
_this._region = new miniprogram$7.Rect(0, 0, 1, 1);
|
|
20183
20241
|
_this._pivot = new miniprogram$7.Vector2(0.5, 0.5);
|
|
20184
20242
|
_this._border = new miniprogram$7.Vector4(0, 0, 0, 0);
|
|
20185
|
-
_this._dirtyUpdateFlag =
|
|
20243
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
20186
20244
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
20187
20245
|
_this._texture = texture;
|
|
20188
20246
|
region && _this._region.copyFrom(region);
|
|
@@ -20231,9 +20289,12 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20231
20289
|
if (this._texture) {
|
|
20232
20290
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
20233
20291
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
20234
|
-
this.
|
|
20235
|
-
this.
|
|
20292
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
20293
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
20294
|
+
} else {
|
|
20295
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
20236
20296
|
}
|
|
20297
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
20237
20298
|
};
|
|
20238
20299
|
_proto._updatePositions = function _updatePositions() {
|
|
20239
20300
|
var blank = this._atlasRegionOffset;
|
|
@@ -20287,11 +20348,16 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20287
20348
|
};
|
|
20288
20349
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
20289
20350
|
switch(type){
|
|
20351
|
+
case SpriteModifyFlags.texture:
|
|
20352
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
20353
|
+
break;
|
|
20290
20354
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
20291
20355
|
case SpriteModifyFlags.region:
|
|
20292
|
-
this._dirtyUpdateFlag |=
|
|
20356
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
20293
20357
|
break;
|
|
20294
20358
|
case SpriteModifyFlags.atlasRegion:
|
|
20359
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
20360
|
+
break;
|
|
20295
20361
|
case SpriteModifyFlags.border:
|
|
20296
20362
|
this._dirtyUpdateFlag |= 0x2;
|
|
20297
20363
|
break;
|
|
@@ -20310,7 +20376,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20310
20376
|
if (this._texture !== value) {
|
|
20311
20377
|
this._texture = value;
|
|
20312
20378
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
20313
|
-
(this.
|
|
20379
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20380
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20381
|
+
}
|
|
20314
20382
|
}
|
|
20315
20383
|
}
|
|
20316
20384
|
},
|
|
@@ -20318,13 +20386,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20318
20386
|
key: "width",
|
|
20319
20387
|
get: /**
|
|
20320
20388
|
* The width of the sprite (in world coordinates).
|
|
20389
|
+
*
|
|
20390
|
+
* @remarks
|
|
20391
|
+
* If width is set, return the set value,
|
|
20392
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20321
20393
|
*/ function get() {
|
|
20322
|
-
this.
|
|
20323
|
-
|
|
20394
|
+
if (this._customWidth !== undefined) {
|
|
20395
|
+
return this._customWidth;
|
|
20396
|
+
} else {
|
|
20397
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20398
|
+
return this._automaticWidth;
|
|
20399
|
+
}
|
|
20324
20400
|
},
|
|
20325
20401
|
set: function set(value) {
|
|
20326
|
-
if (this.
|
|
20327
|
-
this.
|
|
20402
|
+
if (this._customWidth !== value) {
|
|
20403
|
+
this._customWidth = value;
|
|
20328
20404
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20329
20405
|
}
|
|
20330
20406
|
}
|
|
@@ -20333,13 +20409,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20333
20409
|
key: "height",
|
|
20334
20410
|
get: /**
|
|
20335
20411
|
* The height of the sprite (in world coordinates).
|
|
20412
|
+
*
|
|
20413
|
+
* @remarks
|
|
20414
|
+
* If height is set, return the set value,
|
|
20415
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20336
20416
|
*/ function get() {
|
|
20337
|
-
this.
|
|
20338
|
-
|
|
20417
|
+
if (this._customHeight !== undefined) {
|
|
20418
|
+
return this._customHeight;
|
|
20419
|
+
} else {
|
|
20420
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20421
|
+
return this._automaticHeight;
|
|
20422
|
+
}
|
|
20339
20423
|
},
|
|
20340
20424
|
set: function set(value) {
|
|
20341
|
-
if (this.
|
|
20342
|
-
this.
|
|
20425
|
+
if (this._customHeight !== value) {
|
|
20426
|
+
this._customHeight = value;
|
|
20343
20427
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20344
20428
|
}
|
|
20345
20429
|
}
|
|
@@ -20369,7 +20453,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20369
20453
|
var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
|
|
20370
20454
|
this._atlasRegion.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20371
20455
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
20372
|
-
(this.
|
|
20456
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20457
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20458
|
+
}
|
|
20373
20459
|
}
|
|
20374
20460
|
},
|
|
20375
20461
|
{
|
|
@@ -20384,7 +20470,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20384
20470
|
var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
|
|
20385
20471
|
this._atlasRegionOffset.set(x, y, miniprogram$7.MathUtil.clamp(value.z, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.w, 0, 1 - y));
|
|
20386
20472
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
20387
|
-
(this.
|
|
20473
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20474
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20475
|
+
}
|
|
20388
20476
|
}
|
|
20389
20477
|
},
|
|
20390
20478
|
{
|
|
@@ -20400,7 +20488,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20400
20488
|
var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
|
|
20401
20489
|
region.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20402
20490
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
20403
|
-
(this.
|
|
20491
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20492
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20493
|
+
}
|
|
20404
20494
|
}
|
|
20405
20495
|
},
|
|
20406
20496
|
{
|
|
@@ -20450,7 +20540,8 @@ var SpriteUpdateFlags;
|
|
|
20450
20540
|
(function(SpriteUpdateFlags) {
|
|
20451
20541
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
20452
20542
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
20453
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
20543
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
20544
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
20454
20545
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
20455
20546
|
var _SlicedSpriteAssembler;
|
|
20456
20547
|
var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
@@ -20938,8 +21029,10 @@ var TiledType;
|
|
|
20938
21029
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
20939
21030
|
_this._color = new miniprogram$7.Color(1, 1, 1, 1);
|
|
20940
21031
|
_this._sprite = null;
|
|
20941
|
-
_this.
|
|
20942
|
-
_this.
|
|
21032
|
+
_this._automaticWidth = 0;
|
|
21033
|
+
_this._automaticHeight = 0;
|
|
21034
|
+
_this._customWidth = undefined;
|
|
21035
|
+
_this._customHeight = undefined;
|
|
20943
21036
|
_this._flipX = false;
|
|
20944
21037
|
_this._flipY = false;
|
|
20945
21038
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -20957,6 +21050,7 @@ var TiledType;
|
|
|
20957
21050
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20958
21051
|
target._assembler.resetData(target);
|
|
20959
21052
|
target.sprite = this._sprite;
|
|
21053
|
+
target.drawMode = this._drawMode;
|
|
20960
21054
|
};
|
|
20961
21055
|
/**
|
|
20962
21056
|
* @internal
|
|
@@ -20967,12 +21061,11 @@ var TiledType;
|
|
|
20967
21061
|
/**
|
|
20968
21062
|
* @internal
|
|
20969
21063
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
20970
|
-
|
|
20971
|
-
|
|
21064
|
+
if (this.sprite) {
|
|
21065
|
+
this._assembler.updatePositions(this);
|
|
21066
|
+
} else {
|
|
20972
21067
|
worldBounds.min.set(0, 0, 0);
|
|
20973
21068
|
worldBounds.max.set(0, 0, 0);
|
|
20974
|
-
} else {
|
|
20975
|
-
this._assembler.updatePositions(this);
|
|
20976
21069
|
}
|
|
20977
21070
|
};
|
|
20978
21071
|
/**
|
|
@@ -20982,17 +21075,17 @@ var TiledType;
|
|
|
20982
21075
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
20983
21076
|
return;
|
|
20984
21077
|
}
|
|
20985
|
-
// Update position
|
|
21078
|
+
// Update position
|
|
20986
21079
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
20987
21080
|
this._assembler.updatePositions(this);
|
|
20988
21081
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
20989
21082
|
}
|
|
20990
|
-
// Update uv
|
|
21083
|
+
// Update uv
|
|
20991
21084
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
20992
21085
|
this._assembler.updateUVs(this);
|
|
20993
21086
|
this._dirtyUpdateFlag &= ~0x2;
|
|
20994
21087
|
}
|
|
20995
|
-
// Push
|
|
21088
|
+
// Push primitive
|
|
20996
21089
|
var material = this.getMaterial();
|
|
20997
21090
|
var texture = this.sprite.texture;
|
|
20998
21091
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -21010,6 +21103,16 @@ var TiledType;
|
|
|
21010
21103
|
this._assembler = null;
|
|
21011
21104
|
this._verticesData = null;
|
|
21012
21105
|
};
|
|
21106
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
21107
|
+
var sprite = this._sprite;
|
|
21108
|
+
if (sprite) {
|
|
21109
|
+
this._automaticWidth = sprite.width;
|
|
21110
|
+
this._automaticHeight = sprite.height;
|
|
21111
|
+
} else {
|
|
21112
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
21113
|
+
}
|
|
21114
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
21115
|
+
};
|
|
21013
21116
|
_proto._updateStencilState = function _updateStencilState() {
|
|
21014
21117
|
// Update stencil.
|
|
21015
21118
|
var material = this.getInstanceMaterial();
|
|
@@ -21036,22 +21139,21 @@ var TiledType;
|
|
|
21036
21139
|
break;
|
|
21037
21140
|
case SpriteModifyFlags.size:
|
|
21038
21141
|
var _this = this, drawMode = _this._drawMode;
|
|
21039
|
-
|
|
21142
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
21143
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
21040
21144
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21041
21145
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
21042
21146
|
this._dirtyUpdateFlag |= 0x3;
|
|
21043
21147
|
} else {
|
|
21044
21148
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
21045
21149
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
21046
|
-
if (this.
|
|
21150
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21047
21151
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21048
21152
|
}
|
|
21049
21153
|
}
|
|
21050
21154
|
break;
|
|
21051
21155
|
case SpriteModifyFlags.border:
|
|
21052
|
-
|
|
21053
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21054
|
-
}
|
|
21156
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
21055
21157
|
break;
|
|
21056
21158
|
case SpriteModifyFlags.region:
|
|
21057
21159
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -21136,9 +21238,9 @@ var TiledType;
|
|
|
21136
21238
|
var lastSprite = this._sprite;
|
|
21137
21239
|
if (lastSprite !== value) {
|
|
21138
21240
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21241
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
21139
21242
|
if (value) {
|
|
21140
21243
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
21141
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21142
21244
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
21143
21245
|
} else {
|
|
21144
21246
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -21163,16 +21265,22 @@ var TiledType;
|
|
|
21163
21265
|
{
|
|
21164
21266
|
key: "width",
|
|
21165
21267
|
get: /**
|
|
21166
|
-
* Render width.
|
|
21268
|
+
* Render width (in world coordinates).
|
|
21269
|
+
*
|
|
21270
|
+
* @remarks
|
|
21271
|
+
* If width is set, return the set value,
|
|
21272
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
21167
21273
|
*/ function get() {
|
|
21168
|
-
|
|
21169
|
-
|
|
21274
|
+
if (this._customWidth !== undefined) {
|
|
21275
|
+
return this._customWidth;
|
|
21276
|
+
} else {
|
|
21277
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21278
|
+
return this._automaticWidth;
|
|
21279
|
+
}
|
|
21170
21280
|
},
|
|
21171
21281
|
set: function set(value) {
|
|
21172
|
-
|
|
21173
|
-
|
|
21174
|
-
if (this._width !== value) {
|
|
21175
|
-
this._width = value;
|
|
21282
|
+
if (this._customWidth !== value) {
|
|
21283
|
+
this._customWidth = value;
|
|
21176
21284
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21177
21285
|
}
|
|
21178
21286
|
}
|
|
@@ -21180,16 +21288,22 @@ var TiledType;
|
|
|
21180
21288
|
{
|
|
21181
21289
|
key: "height",
|
|
21182
21290
|
get: /**
|
|
21183
|
-
* Render height.
|
|
21291
|
+
* Render height (in world coordinates).
|
|
21292
|
+
*
|
|
21293
|
+
* @remarks
|
|
21294
|
+
* If height is set, return the set value,
|
|
21295
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
21184
21296
|
*/ function get() {
|
|
21185
|
-
|
|
21186
|
-
|
|
21297
|
+
if (this._customHeight !== undefined) {
|
|
21298
|
+
return this._customHeight;
|
|
21299
|
+
} else {
|
|
21300
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21301
|
+
return this._automaticHeight;
|
|
21302
|
+
}
|
|
21187
21303
|
},
|
|
21188
21304
|
set: function set(value) {
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
if (this._height !== value) {
|
|
21192
|
-
this._height = value;
|
|
21305
|
+
if (this._customHeight !== value) {
|
|
21306
|
+
this._customHeight = value;
|
|
21193
21307
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21194
21308
|
}
|
|
21195
21309
|
}
|
|
@@ -21276,10 +21390,16 @@ __decorate$1([
|
|
|
21276
21390
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
21277
21391
|
__decorate$1([
|
|
21278
21392
|
ignoreClone
|
|
21279
|
-
], SpriteRenderer.prototype, "
|
|
21393
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
21280
21394
|
__decorate$1([
|
|
21281
21395
|
ignoreClone
|
|
21282
|
-
], SpriteRenderer.prototype, "
|
|
21396
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
21397
|
+
__decorate$1([
|
|
21398
|
+
assignmentClone
|
|
21399
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
21400
|
+
__decorate$1([
|
|
21401
|
+
assignmentClone
|
|
21402
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
21283
21403
|
__decorate$1([
|
|
21284
21404
|
assignmentClone
|
|
21285
21405
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -21300,7 +21420,9 @@ var /**
|
|
|
21300
21420
|
*/ SpriteRendererUpdateFlags;
|
|
21301
21421
|
(function(SpriteRendererUpdateFlags) {
|
|
21302
21422
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
21303
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
21423
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
21424
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
21425
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
21304
21426
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
21305
21427
|
/**
|
|
21306
21428
|
* @internal
|
|
@@ -26279,6 +26401,12 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
26279
26401
|
this.vertexBuffers = [];
|
|
26280
26402
|
this.blendShapes = [];
|
|
26281
26403
|
};
|
|
26404
|
+
/**
|
|
26405
|
+
* @internal
|
|
26406
|
+
*/ var BufferRestoreInfo = function BufferRestoreInfo(buffer, data) {
|
|
26407
|
+
this.buffer = buffer;
|
|
26408
|
+
this.data = data;
|
|
26409
|
+
};
|
|
26282
26410
|
/**
|
|
26283
26411
|
* @internal
|
|
26284
26412
|
*/ var BufferDataRestoreInfo = function BufferDataRestoreInfo(main, typeSize, sparseCount, sparseIndices, sparseValues) {
|
|
@@ -27614,6 +27742,7 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27614
27742
|
vertexBuffer = new miniprogram$5.Buffer(engine, miniprogram$5.BufferBindFlag.VertexBuffer, vertices.byteLength, miniprogram$5.BufferUsage.Static);
|
|
27615
27743
|
vertexBuffer.setData(vertices);
|
|
27616
27744
|
accessorBuffer.vertexBuffer = vertexBuffer;
|
|
27745
|
+
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer, accessorBuffer.restoreInfo));
|
|
27617
27746
|
}
|
|
27618
27747
|
mesh.setVertexBufferBinding(vertexBuffer, stride, bufferBindIndex);
|
|
27619
27748
|
vertexBindingInfos[meshId] = bufferBindIndex++;
|
|
@@ -27625,6 +27754,7 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27625
27754
|
vertexElement = new miniprogram$5.VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
27626
27755
|
var vertexBuffer1 = new miniprogram$5.Buffer(engine, miniprogram$5.BufferBindFlag.VertexBuffer, vertices.byteLength, miniprogram$5.BufferUsage.Static);
|
|
27627
27756
|
vertexBuffer1.setData(vertices);
|
|
27757
|
+
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer1, accessorBuffer.restoreInfo));
|
|
27628
27758
|
mesh.setVertexBufferBinding(vertexBuffer1, accessorBuffer.stride, bufferBindIndex);
|
|
27629
27759
|
vertexBindingInfos[meshId] = bufferBindIndex++;
|
|
27630
27760
|
}
|
|
@@ -27796,14 +27926,7 @@ var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27796
27926
|
camera.enabled = false;
|
|
27797
27927
|
};
|
|
27798
27928
|
_proto._createRenderer = function _createRenderer(context, glTFNode, entity) {
|
|
27799
|
-
var
|
|
27800
|
-
var glTFMeshes = glTF.meshes;
|
|
27801
|
-
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
27802
|
-
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
27803
|
-
var glTFMesh = glTFMeshes[meshID];
|
|
27804
|
-
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
27805
|
-
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
27806
|
-
for(var i = 0; i < glTFMeshPrimitives.length; i++){
|
|
27929
|
+
var _loop = function _loop(i) {
|
|
27807
27930
|
var gltfPrimitive = glTFMeshPrimitives[i];
|
|
27808
27931
|
var mesh = meshes[meshID][i];
|
|
27809
27932
|
var renderer = void 0;
|
|
@@ -27825,8 +27948,22 @@ var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27825
27948
|
var materialIndex = gltfPrimitive.material;
|
|
27826
27949
|
var material = (materials == null ? void 0 : materials[materialIndex]) || GLTFSceneParser._getDefaultMaterial(engine);
|
|
27827
27950
|
renderer.setMaterial(material);
|
|
27951
|
+
// Enable vertex color if mesh has COLOR_0 vertex element
|
|
27952
|
+
mesh.vertexElements.forEach(function(element) {
|
|
27953
|
+
if (element.semantic === "COLOR_0") {
|
|
27954
|
+
renderer.enableVertexColor = true;
|
|
27955
|
+
}
|
|
27956
|
+
});
|
|
27828
27957
|
GLTFParser.executeExtensionsAdditiveAndParse(gltfPrimitive.extensions, context, renderer, gltfPrimitive);
|
|
27829
|
-
}
|
|
27958
|
+
};
|
|
27959
|
+
var glTFResource = context.glTFResource, glTF = context.glTF;
|
|
27960
|
+
var glTFMeshes = glTF.meshes;
|
|
27961
|
+
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
27962
|
+
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
27963
|
+
var glTFMesh = glTFMeshes[meshID];
|
|
27964
|
+
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
27965
|
+
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
27966
|
+
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
27830
27967
|
};
|
|
27831
27968
|
_proto._createAnimator = function _createAnimator(context) {
|
|
27832
27969
|
if (!context.hasSkinned && !context.glTFResource.animations) {
|
|
@@ -29846,7 +29983,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
|
|
|
29846
29983
|
var atlasItem = atlasItems[i];
|
|
29847
29984
|
if (atlasItem.img) {
|
|
29848
29985
|
chainPromises.push(resourceManager.load({
|
|
29849
|
-
url: atlasItem.img,
|
|
29986
|
+
url: miniprogram$5.Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
29850
29987
|
type: miniprogram$5.AssetType.Texture2D,
|
|
29851
29988
|
params: {
|
|
29852
29989
|
format: format,
|
|
@@ -37535,7 +37672,7 @@ function _interopNamespace(e) {
|
|
|
37535
37672
|
}
|
|
37536
37673
|
var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
|
|
37537
37674
|
//@ts-ignore
|
|
37538
|
-
var version = "1.0.0-beta.
|
|
37675
|
+
var version = "1.0.0-beta.8";
|
|
37539
37676
|
console.log("Galacean engine version: " + version);
|
|
37540
37677
|
for(var key in CoreObjects__namespace){
|
|
37541
37678
|
CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
|