@galacean/engine-physics-physx 1.0.0-beta.7 → 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/browser.js +9 -7
- package/dist/browser.min.js +1 -1
- package/dist/main.js +9 -7
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +241 -102
- package/dist/module.js +9 -7
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/miniprogram.js
CHANGED
|
@@ -9445,9 +9445,9 @@ function _extends$2() {
|
|
|
9445
9445
|
}
|
|
9446
9446
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
9447
9447
|
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
|
|
9448
|
-
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
|
|
9448
|
+
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
|
|
9449
9449
|
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
|
|
9450
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9450
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9451
9451
|
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
|
|
9452
9452
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
9453
9453
|
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
|
|
@@ -9457,7 +9457,7 @@ var begin_normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef
|
|
|
9457
9457
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
9458
9458
|
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
|
|
9459
9459
|
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
|
|
9460
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9460
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9461
9461
|
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
|
|
9462
9462
|
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
|
|
9463
9463
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
@@ -9467,7 +9467,7 @@ var worldpos_vert = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec4 tem
|
|
|
9467
9467
|
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
|
|
9468
9468
|
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
|
|
9469
9469
|
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
|
|
9470
|
-
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
|
|
9470
|
+
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
|
|
9471
9471
|
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
|
|
9472
9472
|
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
|
|
9473
9473
|
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
|
|
@@ -9487,7 +9487,7 @@ var noise_simplex_3D = "#define GLSLIFY 1\nfloat simplex(vec3 v){const vec2 C=ve
|
|
|
9487
9487
|
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
|
|
9488
9488
|
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
|
|
9489
9489
|
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
|
|
9490
|
-
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
|
|
9490
|
+
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
|
|
9491
9491
|
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
|
|
9492
9492
|
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
|
|
9493
9493
|
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
|
|
@@ -11029,8 +11029,10 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11029
11029
|
_this = Renderer.call(this, entity) || this;
|
|
11030
11030
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
11031
11031
|
_this._sprite = null;
|
|
11032
|
-
_this.
|
|
11033
|
-
_this.
|
|
11032
|
+
_this._automaticWidth = 0;
|
|
11033
|
+
_this._automaticHeight = 0;
|
|
11034
|
+
_this._customWidth = undefined;
|
|
11035
|
+
_this._customHeight = undefined;
|
|
11034
11036
|
_this._flipX = false;
|
|
11035
11037
|
_this._flipY = false;
|
|
11036
11038
|
_this._alphaCutoff = 0.5;
|
|
@@ -11050,12 +11052,11 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11050
11052
|
/**
|
|
11051
11053
|
* @internal
|
|
11052
11054
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
+
if (this.sprite) {
|
|
11056
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
11057
|
+
} else {
|
|
11055
11058
|
worldBounds.min.set(0, 0, 0);
|
|
11056
11059
|
worldBounds.max.set(0, 0, 0);
|
|
11057
|
-
} else {
|
|
11058
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
11059
11060
|
}
|
|
11060
11061
|
};
|
|
11061
11062
|
/**
|
|
@@ -11066,12 +11067,12 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11066
11067
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11067
11068
|
return;
|
|
11068
11069
|
}
|
|
11069
|
-
// Update position
|
|
11070
|
+
// Update position
|
|
11070
11071
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
11071
11072
|
SimpleSpriteAssembler.updatePositions(this);
|
|
11072
11073
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
11073
11074
|
}
|
|
11074
|
-
// Update uv
|
|
11075
|
+
// Update uv
|
|
11075
11076
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
11076
11077
|
SimpleSpriteAssembler.updateUVs(this);
|
|
11077
11078
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -11094,11 +11095,27 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11094
11095
|
this._sprite = null;
|
|
11095
11096
|
this._verticesData = null;
|
|
11096
11097
|
};
|
|
11098
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
11099
|
+
var sprite = this._sprite;
|
|
11100
|
+
if (sprite) {
|
|
11101
|
+
this._automaticWidth = sprite.width;
|
|
11102
|
+
this._automaticHeight = sprite.height;
|
|
11103
|
+
} else {
|
|
11104
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
11105
|
+
}
|
|
11106
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
11107
|
+
};
|
|
11097
11108
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
11098
11109
|
switch(type){
|
|
11099
11110
|
case SpriteModifyFlags.texture:
|
|
11100
11111
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
11101
11112
|
break;
|
|
11113
|
+
case SpriteModifyFlags.size:
|
|
11114
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
11115
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
11116
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11117
|
+
}
|
|
11118
|
+
break;
|
|
11102
11119
|
case SpriteModifyFlags.region:
|
|
11103
11120
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
11104
11121
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -11106,22 +11123,31 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11106
11123
|
case SpriteModifyFlags.atlasRegion:
|
|
11107
11124
|
this._dirtyUpdateFlag |= 0x2;
|
|
11108
11125
|
break;
|
|
11126
|
+
case SpriteModifyFlags.pivot:
|
|
11127
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11128
|
+
break;
|
|
11109
11129
|
}
|
|
11110
11130
|
};
|
|
11111
11131
|
_create_class$2(SpriteMask, [
|
|
11112
11132
|
{
|
|
11113
11133
|
key: "width",
|
|
11114
11134
|
get: /**
|
|
11115
|
-
* Render width.
|
|
11135
|
+
* Render width (in world coordinates).
|
|
11136
|
+
*
|
|
11137
|
+
* @remarks
|
|
11138
|
+
* If width is set, return the set value,
|
|
11139
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
11116
11140
|
*/ function get() {
|
|
11117
|
-
if (this.
|
|
11118
|
-
|
|
11141
|
+
if (this._customWidth !== undefined) {
|
|
11142
|
+
return this._customWidth;
|
|
11143
|
+
} else {
|
|
11144
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11145
|
+
return this._automaticWidth;
|
|
11119
11146
|
}
|
|
11120
|
-
return this._width;
|
|
11121
11147
|
},
|
|
11122
11148
|
set: function set(value) {
|
|
11123
|
-
if (this.
|
|
11124
|
-
this.
|
|
11149
|
+
if (this._customWidth !== value) {
|
|
11150
|
+
this._customWidth = value;
|
|
11125
11151
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11126
11152
|
}
|
|
11127
11153
|
}
|
|
@@ -11129,16 +11155,22 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11129
11155
|
{
|
|
11130
11156
|
key: "height",
|
|
11131
11157
|
get: /**
|
|
11132
|
-
* Render height.
|
|
11158
|
+
* Render height (in world coordinates).
|
|
11159
|
+
*
|
|
11160
|
+
* @remarks
|
|
11161
|
+
* If height is set, return the set value,
|
|
11162
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
11133
11163
|
*/ function get() {
|
|
11134
|
-
if (this.
|
|
11135
|
-
|
|
11164
|
+
if (this._customHeight !== undefined) {
|
|
11165
|
+
return this._customHeight;
|
|
11166
|
+
} else {
|
|
11167
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11168
|
+
return this._automaticHeight;
|
|
11136
11169
|
}
|
|
11137
|
-
return this._height;
|
|
11138
11170
|
},
|
|
11139
11171
|
set: function set(value) {
|
|
11140
|
-
if (this.
|
|
11141
|
-
this.
|
|
11172
|
+
if (this._customHeight !== value) {
|
|
11173
|
+
this._customHeight = value;
|
|
11142
11174
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11143
11175
|
}
|
|
11144
11176
|
}
|
|
@@ -11182,9 +11214,9 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11182
11214
|
var lastSprite = this._sprite;
|
|
11183
11215
|
if (lastSprite !== value) {
|
|
11184
11216
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11217
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
11185
11218
|
if (value) {
|
|
11186
11219
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
11187
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
11188
11220
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
11189
11221
|
} else {
|
|
11190
11222
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -11224,10 +11256,16 @@ __decorate$1([
|
|
|
11224
11256
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
11225
11257
|
__decorate$1([
|
|
11226
11258
|
ignoreClone
|
|
11227
|
-
], SpriteMask.prototype, "
|
|
11259
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
11228
11260
|
__decorate$1([
|
|
11229
11261
|
ignoreClone
|
|
11230
|
-
], SpriteMask.prototype, "
|
|
11262
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
11263
|
+
__decorate$1([
|
|
11264
|
+
assignmentClone
|
|
11265
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
11266
|
+
__decorate$1([
|
|
11267
|
+
assignmentClone
|
|
11268
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
11231
11269
|
__decorate$1([
|
|
11232
11270
|
assignmentClone
|
|
11233
11271
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -11245,7 +11283,9 @@ var /**
|
|
|
11245
11283
|
*/ SpriteMaskUpdateFlags;
|
|
11246
11284
|
(function(SpriteMaskUpdateFlags) {
|
|
11247
11285
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
11248
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
11286
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
11287
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
11288
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
11249
11289
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
11250
11290
|
/**
|
|
11251
11291
|
* Vertex element format.
|
|
@@ -12038,6 +12078,7 @@ var MeshModifyFlags;
|
|
|
12038
12078
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
12039
12079
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
12040
12080
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
12081
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
12041
12082
|
// @todo: should fix bug when dataChangedFlag is true
|
|
12042
12083
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
12043
12084
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -12055,7 +12096,7 @@ var MeshModifyFlags;
|
|
|
12055
12096
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
12056
12097
|
var storeInfo = storeInfos[i];
|
|
12057
12098
|
storeInfo || (storeInfos[i] = storeInfo = new miniprogram$7.Vector2());
|
|
12058
|
-
storeInfo.set(
|
|
12099
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
12059
12100
|
var deltaPositions = endFrame.deltaPositions;
|
|
12060
12101
|
for(var j = 0; j < vertexCount; j++){
|
|
12061
12102
|
var start = offset + bufferFloatStride * j;
|
|
@@ -13327,6 +13368,7 @@ var VertexChangedFlags;
|
|
|
13327
13368
|
var MeshRenderer = function MeshRenderer(entity) {
|
|
13328
13369
|
var _this;
|
|
13329
13370
|
_this = Renderer.call(this, entity) || this;
|
|
13371
|
+
_this._enableVertexColor = false;
|
|
13330
13372
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13331
13373
|
return _this;
|
|
13332
13374
|
};
|
|
@@ -13372,7 +13414,7 @@ var VertexChangedFlags;
|
|
|
13372
13414
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13373
13415
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13374
13416
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13375
|
-
shaderData.disableMacro(MeshRenderer.
|
|
13417
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13376
13418
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13377
13419
|
switch(vertexElements[i].semantic){
|
|
13378
13420
|
case "TEXCOORD_0":
|
|
@@ -13388,7 +13430,7 @@ var VertexChangedFlags;
|
|
|
13388
13430
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13389
13431
|
break;
|
|
13390
13432
|
case "COLOR_0":
|
|
13391
|
-
shaderData.enableMacro(MeshRenderer.
|
|
13433
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13392
13434
|
break;
|
|
13393
13435
|
}
|
|
13394
13436
|
}
|
|
@@ -13439,6 +13481,20 @@ var VertexChangedFlags;
|
|
|
13439
13481
|
this._setMesh(value);
|
|
13440
13482
|
}
|
|
13441
13483
|
}
|
|
13484
|
+
},
|
|
13485
|
+
{
|
|
13486
|
+
key: "enableVertexColor",
|
|
13487
|
+
get: /**
|
|
13488
|
+
* Whether enable vertex color.
|
|
13489
|
+
*/ function get() {
|
|
13490
|
+
return this._enableVertexColor;
|
|
13491
|
+
},
|
|
13492
|
+
set: function set(value) {
|
|
13493
|
+
if (value !== this._enableVertexColor) {
|
|
13494
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13495
|
+
this._enableVertexColor = value;
|
|
13496
|
+
}
|
|
13497
|
+
}
|
|
13442
13498
|
}
|
|
13443
13499
|
]);
|
|
13444
13500
|
return MeshRenderer;
|
|
@@ -13456,7 +13512,7 @@ var VertexChangedFlags;
|
|
|
13456
13512
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13457
13513
|
})();
|
|
13458
13514
|
(function() {
|
|
13459
|
-
MeshRenderer.
|
|
13515
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
13460
13516
|
})();
|
|
13461
13517
|
__decorate$1([
|
|
13462
13518
|
ignoreClone
|
|
@@ -20153,8 +20209,10 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20153
20209
|
if (name === void 0) name = null;
|
|
20154
20210
|
var _this;
|
|
20155
20211
|
_this = ReferResource.call(this, engine) || this;
|
|
20156
|
-
_this.
|
|
20157
|
-
_this.
|
|
20212
|
+
_this._automaticWidth = 0;
|
|
20213
|
+
_this._automaticHeight = 0;
|
|
20214
|
+
_this._customWidth = undefined;
|
|
20215
|
+
_this._customHeight = undefined;
|
|
20158
20216
|
_this._positions = [
|
|
20159
20217
|
new miniprogram$7.Vector2(),
|
|
20160
20218
|
new miniprogram$7.Vector2(),
|
|
@@ -20175,7 +20233,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20175
20233
|
_this._region = new miniprogram$7.Rect(0, 0, 1, 1);
|
|
20176
20234
|
_this._pivot = new miniprogram$7.Vector2(0.5, 0.5);
|
|
20177
20235
|
_this._border = new miniprogram$7.Vector4(0, 0, 0, 0);
|
|
20178
|
-
_this._dirtyUpdateFlag =
|
|
20236
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
20179
20237
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
20180
20238
|
_this._texture = texture;
|
|
20181
20239
|
region && _this._region.copyFrom(region);
|
|
@@ -20224,9 +20282,12 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20224
20282
|
if (this._texture) {
|
|
20225
20283
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
20226
20284
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
20227
|
-
this.
|
|
20228
|
-
this.
|
|
20285
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
20286
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
20287
|
+
} else {
|
|
20288
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
20229
20289
|
}
|
|
20290
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
20230
20291
|
};
|
|
20231
20292
|
_proto._updatePositions = function _updatePositions() {
|
|
20232
20293
|
var blank = this._atlasRegionOffset;
|
|
@@ -20280,11 +20341,16 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20280
20341
|
};
|
|
20281
20342
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
20282
20343
|
switch(type){
|
|
20344
|
+
case SpriteModifyFlags.texture:
|
|
20345
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
20346
|
+
break;
|
|
20283
20347
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
20284
20348
|
case SpriteModifyFlags.region:
|
|
20285
|
-
this._dirtyUpdateFlag |=
|
|
20349
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
20286
20350
|
break;
|
|
20287
20351
|
case SpriteModifyFlags.atlasRegion:
|
|
20352
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
20353
|
+
break;
|
|
20288
20354
|
case SpriteModifyFlags.border:
|
|
20289
20355
|
this._dirtyUpdateFlag |= 0x2;
|
|
20290
20356
|
break;
|
|
@@ -20303,7 +20369,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20303
20369
|
if (this._texture !== value) {
|
|
20304
20370
|
this._texture = value;
|
|
20305
20371
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
20306
|
-
(this.
|
|
20372
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20373
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20374
|
+
}
|
|
20307
20375
|
}
|
|
20308
20376
|
}
|
|
20309
20377
|
},
|
|
@@ -20311,13 +20379,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20311
20379
|
key: "width",
|
|
20312
20380
|
get: /**
|
|
20313
20381
|
* The width of the sprite (in world coordinates).
|
|
20382
|
+
*
|
|
20383
|
+
* @remarks
|
|
20384
|
+
* If width is set, return the set value,
|
|
20385
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20314
20386
|
*/ function get() {
|
|
20315
|
-
this.
|
|
20316
|
-
|
|
20387
|
+
if (this._customWidth !== undefined) {
|
|
20388
|
+
return this._customWidth;
|
|
20389
|
+
} else {
|
|
20390
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20391
|
+
return this._automaticWidth;
|
|
20392
|
+
}
|
|
20317
20393
|
},
|
|
20318
20394
|
set: function set(value) {
|
|
20319
|
-
if (this.
|
|
20320
|
-
this.
|
|
20395
|
+
if (this._customWidth !== value) {
|
|
20396
|
+
this._customWidth = value;
|
|
20321
20397
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20322
20398
|
}
|
|
20323
20399
|
}
|
|
@@ -20326,13 +20402,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20326
20402
|
key: "height",
|
|
20327
20403
|
get: /**
|
|
20328
20404
|
* The height of the sprite (in world coordinates).
|
|
20405
|
+
*
|
|
20406
|
+
* @remarks
|
|
20407
|
+
* If height is set, return the set value,
|
|
20408
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20329
20409
|
*/ function get() {
|
|
20330
|
-
this.
|
|
20331
|
-
|
|
20410
|
+
if (this._customHeight !== undefined) {
|
|
20411
|
+
return this._customHeight;
|
|
20412
|
+
} else {
|
|
20413
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20414
|
+
return this._automaticHeight;
|
|
20415
|
+
}
|
|
20332
20416
|
},
|
|
20333
20417
|
set: function set(value) {
|
|
20334
|
-
if (this.
|
|
20335
|
-
this.
|
|
20418
|
+
if (this._customHeight !== value) {
|
|
20419
|
+
this._customHeight = value;
|
|
20336
20420
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20337
20421
|
}
|
|
20338
20422
|
}
|
|
@@ -20362,7 +20446,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20362
20446
|
var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
|
|
20363
20447
|
this._atlasRegion.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20364
20448
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
20365
|
-
(this.
|
|
20449
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20450
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20451
|
+
}
|
|
20366
20452
|
}
|
|
20367
20453
|
},
|
|
20368
20454
|
{
|
|
@@ -20377,7 +20463,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20377
20463
|
var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
|
|
20378
20464
|
this._atlasRegionOffset.set(x, y, miniprogram$7.MathUtil.clamp(value.z, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.w, 0, 1 - y));
|
|
20379
20465
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
20380
|
-
(this.
|
|
20466
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20467
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20468
|
+
}
|
|
20381
20469
|
}
|
|
20382
20470
|
},
|
|
20383
20471
|
{
|
|
@@ -20393,7 +20481,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20393
20481
|
var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
|
|
20394
20482
|
region.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20395
20483
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
20396
|
-
(this.
|
|
20484
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20485
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20486
|
+
}
|
|
20397
20487
|
}
|
|
20398
20488
|
},
|
|
20399
20489
|
{
|
|
@@ -20443,7 +20533,8 @@ var SpriteUpdateFlags;
|
|
|
20443
20533
|
(function(SpriteUpdateFlags) {
|
|
20444
20534
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
20445
20535
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
20446
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
20536
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
20537
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
20447
20538
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
20448
20539
|
var _SlicedSpriteAssembler;
|
|
20449
20540
|
var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
@@ -20931,8 +21022,10 @@ var TiledType;
|
|
|
20931
21022
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
20932
21023
|
_this._color = new miniprogram$7.Color(1, 1, 1, 1);
|
|
20933
21024
|
_this._sprite = null;
|
|
20934
|
-
_this.
|
|
20935
|
-
_this.
|
|
21025
|
+
_this._automaticWidth = 0;
|
|
21026
|
+
_this._automaticHeight = 0;
|
|
21027
|
+
_this._customWidth = undefined;
|
|
21028
|
+
_this._customHeight = undefined;
|
|
20936
21029
|
_this._flipX = false;
|
|
20937
21030
|
_this._flipY = false;
|
|
20938
21031
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -20950,6 +21043,7 @@ var TiledType;
|
|
|
20950
21043
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20951
21044
|
target._assembler.resetData(target);
|
|
20952
21045
|
target.sprite = this._sprite;
|
|
21046
|
+
target.drawMode = this._drawMode;
|
|
20953
21047
|
};
|
|
20954
21048
|
/**
|
|
20955
21049
|
* @internal
|
|
@@ -20960,12 +21054,11 @@ var TiledType;
|
|
|
20960
21054
|
/**
|
|
20961
21055
|
* @internal
|
|
20962
21056
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
20963
|
-
|
|
20964
|
-
|
|
21057
|
+
if (this.sprite) {
|
|
21058
|
+
this._assembler.updatePositions(this);
|
|
21059
|
+
} else {
|
|
20965
21060
|
worldBounds.min.set(0, 0, 0);
|
|
20966
21061
|
worldBounds.max.set(0, 0, 0);
|
|
20967
|
-
} else {
|
|
20968
|
-
this._assembler.updatePositions(this);
|
|
20969
21062
|
}
|
|
20970
21063
|
};
|
|
20971
21064
|
/**
|
|
@@ -20975,17 +21068,17 @@ var TiledType;
|
|
|
20975
21068
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
20976
21069
|
return;
|
|
20977
21070
|
}
|
|
20978
|
-
// Update position
|
|
21071
|
+
// Update position
|
|
20979
21072
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
20980
21073
|
this._assembler.updatePositions(this);
|
|
20981
21074
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
20982
21075
|
}
|
|
20983
|
-
// Update uv
|
|
21076
|
+
// Update uv
|
|
20984
21077
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
20985
21078
|
this._assembler.updateUVs(this);
|
|
20986
21079
|
this._dirtyUpdateFlag &= ~0x2;
|
|
20987
21080
|
}
|
|
20988
|
-
// Push
|
|
21081
|
+
// Push primitive
|
|
20989
21082
|
var material = this.getMaterial();
|
|
20990
21083
|
var texture = this.sprite.texture;
|
|
20991
21084
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -21003,6 +21096,16 @@ var TiledType;
|
|
|
21003
21096
|
this._assembler = null;
|
|
21004
21097
|
this._verticesData = null;
|
|
21005
21098
|
};
|
|
21099
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
21100
|
+
var sprite = this._sprite;
|
|
21101
|
+
if (sprite) {
|
|
21102
|
+
this._automaticWidth = sprite.width;
|
|
21103
|
+
this._automaticHeight = sprite.height;
|
|
21104
|
+
} else {
|
|
21105
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
21106
|
+
}
|
|
21107
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
21108
|
+
};
|
|
21006
21109
|
_proto._updateStencilState = function _updateStencilState() {
|
|
21007
21110
|
// Update stencil.
|
|
21008
21111
|
var material = this.getInstanceMaterial();
|
|
@@ -21029,22 +21132,21 @@ var TiledType;
|
|
|
21029
21132
|
break;
|
|
21030
21133
|
case SpriteModifyFlags.size:
|
|
21031
21134
|
var _this = this, drawMode = _this._drawMode;
|
|
21032
|
-
|
|
21135
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
21136
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
21033
21137
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21034
21138
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
21035
21139
|
this._dirtyUpdateFlag |= 0x3;
|
|
21036
21140
|
} else {
|
|
21037
21141
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
21038
21142
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
21039
|
-
if (this.
|
|
21143
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21040
21144
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21041
21145
|
}
|
|
21042
21146
|
}
|
|
21043
21147
|
break;
|
|
21044
21148
|
case SpriteModifyFlags.border:
|
|
21045
|
-
|
|
21046
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21047
|
-
}
|
|
21149
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
21048
21150
|
break;
|
|
21049
21151
|
case SpriteModifyFlags.region:
|
|
21050
21152
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -21129,9 +21231,9 @@ var TiledType;
|
|
|
21129
21231
|
var lastSprite = this._sprite;
|
|
21130
21232
|
if (lastSprite !== value) {
|
|
21131
21233
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21234
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
21132
21235
|
if (value) {
|
|
21133
21236
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
21134
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21135
21237
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
21136
21238
|
} else {
|
|
21137
21239
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -21156,16 +21258,22 @@ var TiledType;
|
|
|
21156
21258
|
{
|
|
21157
21259
|
key: "width",
|
|
21158
21260
|
get: /**
|
|
21159
|
-
* Render width.
|
|
21261
|
+
* Render width (in world coordinates).
|
|
21262
|
+
*
|
|
21263
|
+
* @remarks
|
|
21264
|
+
* If width is set, return the set value,
|
|
21265
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
21160
21266
|
*/ function get() {
|
|
21161
|
-
|
|
21162
|
-
|
|
21267
|
+
if (this._customWidth !== undefined) {
|
|
21268
|
+
return this._customWidth;
|
|
21269
|
+
} else {
|
|
21270
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21271
|
+
return this._automaticWidth;
|
|
21272
|
+
}
|
|
21163
21273
|
},
|
|
21164
21274
|
set: function set(value) {
|
|
21165
|
-
|
|
21166
|
-
|
|
21167
|
-
if (this._width !== value) {
|
|
21168
|
-
this._width = value;
|
|
21275
|
+
if (this._customWidth !== value) {
|
|
21276
|
+
this._customWidth = value;
|
|
21169
21277
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21170
21278
|
}
|
|
21171
21279
|
}
|
|
@@ -21173,16 +21281,22 @@ var TiledType;
|
|
|
21173
21281
|
{
|
|
21174
21282
|
key: "height",
|
|
21175
21283
|
get: /**
|
|
21176
|
-
* Render height.
|
|
21284
|
+
* Render height (in world coordinates).
|
|
21285
|
+
*
|
|
21286
|
+
* @remarks
|
|
21287
|
+
* If height is set, return the set value,
|
|
21288
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
21177
21289
|
*/ function get() {
|
|
21178
|
-
|
|
21179
|
-
|
|
21290
|
+
if (this._customHeight !== undefined) {
|
|
21291
|
+
return this._customHeight;
|
|
21292
|
+
} else {
|
|
21293
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21294
|
+
return this._automaticHeight;
|
|
21295
|
+
}
|
|
21180
21296
|
},
|
|
21181
21297
|
set: function set(value) {
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
if (this._height !== value) {
|
|
21185
|
-
this._height = value;
|
|
21298
|
+
if (this._customHeight !== value) {
|
|
21299
|
+
this._customHeight = value;
|
|
21186
21300
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21187
21301
|
}
|
|
21188
21302
|
}
|
|
@@ -21269,10 +21383,16 @@ __decorate$1([
|
|
|
21269
21383
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
21270
21384
|
__decorate$1([
|
|
21271
21385
|
ignoreClone
|
|
21272
|
-
], SpriteRenderer.prototype, "
|
|
21386
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
21273
21387
|
__decorate$1([
|
|
21274
21388
|
ignoreClone
|
|
21275
|
-
], SpriteRenderer.prototype, "
|
|
21389
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
21390
|
+
__decorate$1([
|
|
21391
|
+
assignmentClone
|
|
21392
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
21393
|
+
__decorate$1([
|
|
21394
|
+
assignmentClone
|
|
21395
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
21276
21396
|
__decorate$1([
|
|
21277
21397
|
assignmentClone
|
|
21278
21398
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -21293,7 +21413,9 @@ var /**
|
|
|
21293
21413
|
*/ SpriteRendererUpdateFlags;
|
|
21294
21414
|
(function(SpriteRendererUpdateFlags) {
|
|
21295
21415
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
21296
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
21416
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
21417
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
21418
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
21297
21419
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
21298
21420
|
/**
|
|
21299
21421
|
* @internal
|
|
@@ -26272,6 +26394,12 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
26272
26394
|
this.vertexBuffers = [];
|
|
26273
26395
|
this.blendShapes = [];
|
|
26274
26396
|
};
|
|
26397
|
+
/**
|
|
26398
|
+
* @internal
|
|
26399
|
+
*/ var BufferRestoreInfo = function BufferRestoreInfo(buffer, data) {
|
|
26400
|
+
this.buffer = buffer;
|
|
26401
|
+
this.data = data;
|
|
26402
|
+
};
|
|
26275
26403
|
/**
|
|
26276
26404
|
* @internal
|
|
26277
26405
|
*/ var BufferDataRestoreInfo = function BufferDataRestoreInfo(main, typeSize, sparseCount, sparseIndices, sparseValues) {
|
|
@@ -27607,6 +27735,7 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27607
27735
|
vertexBuffer = new miniprogram$5.Buffer(engine, miniprogram$5.BufferBindFlag.VertexBuffer, vertices.byteLength, miniprogram$5.BufferUsage.Static);
|
|
27608
27736
|
vertexBuffer.setData(vertices);
|
|
27609
27737
|
accessorBuffer.vertexBuffer = vertexBuffer;
|
|
27738
|
+
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer, accessorBuffer.restoreInfo));
|
|
27610
27739
|
}
|
|
27611
27740
|
mesh.setVertexBufferBinding(vertexBuffer, stride, bufferBindIndex);
|
|
27612
27741
|
vertexBindingInfos[meshId] = bufferBindIndex++;
|
|
@@ -27618,6 +27747,7 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27618
27747
|
vertexElement = new miniprogram$5.VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
27619
27748
|
var vertexBuffer1 = new miniprogram$5.Buffer(engine, miniprogram$5.BufferBindFlag.VertexBuffer, vertices.byteLength, miniprogram$5.BufferUsage.Static);
|
|
27620
27749
|
vertexBuffer1.setData(vertices);
|
|
27750
|
+
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer1, accessorBuffer.restoreInfo));
|
|
27621
27751
|
mesh.setVertexBufferBinding(vertexBuffer1, accessorBuffer.stride, bufferBindIndex);
|
|
27622
27752
|
vertexBindingInfos[meshId] = bufferBindIndex++;
|
|
27623
27753
|
}
|
|
@@ -27789,14 +27919,7 @@ var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27789
27919
|
camera.enabled = false;
|
|
27790
27920
|
};
|
|
27791
27921
|
_proto._createRenderer = function _createRenderer(context, glTFNode, entity) {
|
|
27792
|
-
var
|
|
27793
|
-
var glTFMeshes = glTF.meshes;
|
|
27794
|
-
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
27795
|
-
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
27796
|
-
var glTFMesh = glTFMeshes[meshID];
|
|
27797
|
-
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
27798
|
-
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
27799
|
-
for(var i = 0; i < glTFMeshPrimitives.length; i++){
|
|
27922
|
+
var _loop = function _loop(i) {
|
|
27800
27923
|
var gltfPrimitive = glTFMeshPrimitives[i];
|
|
27801
27924
|
var mesh = meshes[meshID][i];
|
|
27802
27925
|
var renderer = void 0;
|
|
@@ -27818,8 +27941,22 @@ var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27818
27941
|
var materialIndex = gltfPrimitive.material;
|
|
27819
27942
|
var material = (materials == null ? void 0 : materials[materialIndex]) || GLTFSceneParser._getDefaultMaterial(engine);
|
|
27820
27943
|
renderer.setMaterial(material);
|
|
27944
|
+
// Enable vertex color if mesh has COLOR_0 vertex element
|
|
27945
|
+
mesh.vertexElements.forEach(function(element) {
|
|
27946
|
+
if (element.semantic === "COLOR_0") {
|
|
27947
|
+
renderer.enableVertexColor = true;
|
|
27948
|
+
}
|
|
27949
|
+
});
|
|
27821
27950
|
GLTFParser.executeExtensionsAdditiveAndParse(gltfPrimitive.extensions, context, renderer, gltfPrimitive);
|
|
27822
|
-
}
|
|
27951
|
+
};
|
|
27952
|
+
var glTFResource = context.glTFResource, glTF = context.glTF;
|
|
27953
|
+
var glTFMeshes = glTF.meshes;
|
|
27954
|
+
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
27955
|
+
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
27956
|
+
var glTFMesh = glTFMeshes[meshID];
|
|
27957
|
+
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
27958
|
+
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
27959
|
+
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
27823
27960
|
};
|
|
27824
27961
|
_proto._createAnimator = function _createAnimator(context) {
|
|
27825
27962
|
if (!context.hasSkinned && !context.glTFResource.animations) {
|
|
@@ -29839,7 +29976,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
|
|
|
29839
29976
|
var atlasItem = atlasItems[i];
|
|
29840
29977
|
if (atlasItem.img) {
|
|
29841
29978
|
chainPromises.push(resourceManager.load({
|
|
29842
|
-
url: atlasItem.img,
|
|
29979
|
+
url: miniprogram$5.Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
29843
29980
|
type: miniprogram$5.AssetType.Texture2D,
|
|
29844
29981
|
params: {
|
|
29845
29982
|
format: format,
|
|
@@ -37528,7 +37665,7 @@ function _interopNamespace(e) {
|
|
|
37528
37665
|
}
|
|
37529
37666
|
var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
|
|
37530
37667
|
//@ts-ignore
|
|
37531
|
-
var version = "1.0.0-beta.
|
|
37668
|
+
var version = "1.0.0-beta.8";
|
|
37532
37669
|
console.log("Galacean engine version: " + version);
|
|
37533
37670
|
for(var key in CoreObjects__namespace){
|
|
37534
37671
|
CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
|
|
@@ -38534,12 +38671,15 @@ var CollisionDetectionMode;
|
|
|
38534
38671
|
/**
|
|
38535
38672
|
* {@inheritDoc IPhysicsManager.addCharacterController }
|
|
38536
38673
|
*/ _proto.addCharacterController = function addCharacterController(characterController) {
|
|
38537
|
-
|
|
38538
|
-
|
|
38539
|
-
|
|
38540
|
-
if (
|
|
38541
|
-
lastPXManager
|
|
38542
|
-
|
|
38674
|
+
// Physx have no API to remove/readd cct into scene.
|
|
38675
|
+
if (!characterController._pxController) {
|
|
38676
|
+
var shape = characterController._shape;
|
|
38677
|
+
if (shape) {
|
|
38678
|
+
var lastPXManager = characterController._pxManager;
|
|
38679
|
+
if (lastPXManager !== this) {
|
|
38680
|
+
lastPXManager && characterController._destroyPXController();
|
|
38681
|
+
characterController._createPXController(this, shape);
|
|
38682
|
+
}
|
|
38543
38683
|
}
|
|
38544
38684
|
}
|
|
38545
38685
|
characterController._pxManager = this;
|
|
@@ -38547,7 +38687,6 @@ var CollisionDetectionMode;
|
|
|
38547
38687
|
/**
|
|
38548
38688
|
* {@inheritDoc IPhysicsManager.removeCharacterController }
|
|
38549
38689
|
*/ _proto.removeCharacterController = function removeCharacterController(characterController) {
|
|
38550
|
-
characterController._pxController = null;
|
|
38551
38690
|
characterController._pxManager = null;
|
|
38552
38691
|
};
|
|
38553
38692
|
/**
|