@galacean/engine 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/browser.js +234 -97
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -14252,9 +14252,9 @@
|
|
|
14252
14252
|
}
|
|
14253
14253
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
14254
14254
|
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
|
|
14255
|
-
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
|
|
14255
|
+
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
|
|
14256
14256
|
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
|
|
14257
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
14257
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
14258
14258
|
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
|
|
14259
14259
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
14260
14260
|
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
|
|
@@ -14264,7 +14264,7 @@
|
|
|
14264
14264
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
14265
14265
|
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
|
|
14266
14266
|
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
|
|
14267
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
14267
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
14268
14268
|
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
|
|
14269
14269
|
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
|
|
14270
14270
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
@@ -14274,7 +14274,7 @@
|
|
|
14274
14274
|
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
|
|
14275
14275
|
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
|
|
14276
14276
|
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
|
|
14277
|
-
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
|
|
14277
|
+
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
|
|
14278
14278
|
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
|
|
14279
14279
|
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
|
|
14280
14280
|
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
|
|
@@ -14294,7 +14294,7 @@
|
|
|
14294
14294
|
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
|
|
14295
14295
|
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
|
|
14296
14296
|
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
|
|
14297
|
-
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
|
|
14297
|
+
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
|
|
14298
14298
|
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
|
|
14299
14299
|
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
|
|
14300
14300
|
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
|
|
@@ -15836,8 +15836,10 @@
|
|
|
15836
15836
|
_this = Renderer.call(this, entity) || this;
|
|
15837
15837
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
15838
15838
|
_this._sprite = null;
|
|
15839
|
-
_this.
|
|
15840
|
-
_this.
|
|
15839
|
+
_this._automaticWidth = 0;
|
|
15840
|
+
_this._automaticHeight = 0;
|
|
15841
|
+
_this._customWidth = undefined;
|
|
15842
|
+
_this._customHeight = undefined;
|
|
15841
15843
|
_this._flipX = false;
|
|
15842
15844
|
_this._flipY = false;
|
|
15843
15845
|
_this._alphaCutoff = 0.5;
|
|
@@ -15857,12 +15859,11 @@
|
|
|
15857
15859
|
/**
|
|
15858
15860
|
* @internal
|
|
15859
15861
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
+
if (this.sprite) {
|
|
15863
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
15864
|
+
} else {
|
|
15862
15865
|
worldBounds.min.set(0, 0, 0);
|
|
15863
15866
|
worldBounds.max.set(0, 0, 0);
|
|
15864
|
-
} else {
|
|
15865
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
15866
15867
|
}
|
|
15867
15868
|
};
|
|
15868
15869
|
/**
|
|
@@ -15873,12 +15874,12 @@
|
|
|
15873
15874
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
15874
15875
|
return;
|
|
15875
15876
|
}
|
|
15876
|
-
// Update position
|
|
15877
|
+
// Update position
|
|
15877
15878
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
15878
15879
|
SimpleSpriteAssembler.updatePositions(this);
|
|
15879
15880
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
15880
15881
|
}
|
|
15881
|
-
// Update uv
|
|
15882
|
+
// Update uv
|
|
15882
15883
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
15883
15884
|
SimpleSpriteAssembler.updateUVs(this);
|
|
15884
15885
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -15901,11 +15902,27 @@
|
|
|
15901
15902
|
this._sprite = null;
|
|
15902
15903
|
this._verticesData = null;
|
|
15903
15904
|
};
|
|
15905
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
15906
|
+
var sprite = this._sprite;
|
|
15907
|
+
if (sprite) {
|
|
15908
|
+
this._automaticWidth = sprite.width;
|
|
15909
|
+
this._automaticHeight = sprite.height;
|
|
15910
|
+
} else {
|
|
15911
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
15912
|
+
}
|
|
15913
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
15914
|
+
};
|
|
15904
15915
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
15905
15916
|
switch(type){
|
|
15906
15917
|
case SpriteModifyFlags.texture:
|
|
15907
15918
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
15908
15919
|
break;
|
|
15920
|
+
case SpriteModifyFlags.size:
|
|
15921
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
15922
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
15923
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15924
|
+
}
|
|
15925
|
+
break;
|
|
15909
15926
|
case SpriteModifyFlags.region:
|
|
15910
15927
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
15911
15928
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -15913,22 +15930,31 @@
|
|
|
15913
15930
|
case SpriteModifyFlags.atlasRegion:
|
|
15914
15931
|
this._dirtyUpdateFlag |= 0x2;
|
|
15915
15932
|
break;
|
|
15933
|
+
case SpriteModifyFlags.pivot:
|
|
15934
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15935
|
+
break;
|
|
15916
15936
|
}
|
|
15917
15937
|
};
|
|
15918
15938
|
_create_class$3(SpriteMask, [
|
|
15919
15939
|
{
|
|
15920
15940
|
key: "width",
|
|
15921
15941
|
get: /**
|
|
15922
|
-
* Render width.
|
|
15942
|
+
* Render width (in world coordinates).
|
|
15943
|
+
*
|
|
15944
|
+
* @remarks
|
|
15945
|
+
* If width is set, return the set value,
|
|
15946
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
15923
15947
|
*/ function get() {
|
|
15924
|
-
if (this.
|
|
15925
|
-
|
|
15948
|
+
if (this._customWidth !== undefined) {
|
|
15949
|
+
return this._customWidth;
|
|
15950
|
+
} else {
|
|
15951
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
15952
|
+
return this._automaticWidth;
|
|
15926
15953
|
}
|
|
15927
|
-
return this._width;
|
|
15928
15954
|
},
|
|
15929
15955
|
set: function set(value) {
|
|
15930
|
-
if (this.
|
|
15931
|
-
this.
|
|
15956
|
+
if (this._customWidth !== value) {
|
|
15957
|
+
this._customWidth = value;
|
|
15932
15958
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15933
15959
|
}
|
|
15934
15960
|
}
|
|
@@ -15936,16 +15962,22 @@
|
|
|
15936
15962
|
{
|
|
15937
15963
|
key: "height",
|
|
15938
15964
|
get: /**
|
|
15939
|
-
* Render height.
|
|
15965
|
+
* Render height (in world coordinates).
|
|
15966
|
+
*
|
|
15967
|
+
* @remarks
|
|
15968
|
+
* If height is set, return the set value,
|
|
15969
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
15940
15970
|
*/ function get() {
|
|
15941
|
-
if (this.
|
|
15942
|
-
|
|
15971
|
+
if (this._customHeight !== undefined) {
|
|
15972
|
+
return this._customHeight;
|
|
15973
|
+
} else {
|
|
15974
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
15975
|
+
return this._automaticHeight;
|
|
15943
15976
|
}
|
|
15944
|
-
return this._height;
|
|
15945
15977
|
},
|
|
15946
15978
|
set: function set(value) {
|
|
15947
|
-
if (this.
|
|
15948
|
-
this.
|
|
15979
|
+
if (this._customHeight !== value) {
|
|
15980
|
+
this._customHeight = value;
|
|
15949
15981
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15950
15982
|
}
|
|
15951
15983
|
}
|
|
@@ -15989,9 +16021,9 @@
|
|
|
15989
16021
|
var lastSprite = this._sprite;
|
|
15990
16022
|
if (lastSprite !== value) {
|
|
15991
16023
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
16024
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
15992
16025
|
if (value) {
|
|
15993
16026
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
15994
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
15995
16027
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
15996
16028
|
} else {
|
|
15997
16029
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -16031,10 +16063,16 @@
|
|
|
16031
16063
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
16032
16064
|
__decorate$1([
|
|
16033
16065
|
ignoreClone
|
|
16034
|
-
], SpriteMask.prototype, "
|
|
16066
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
16035
16067
|
__decorate$1([
|
|
16036
16068
|
ignoreClone
|
|
16037
|
-
], SpriteMask.prototype, "
|
|
16069
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
16070
|
+
__decorate$1([
|
|
16071
|
+
assignmentClone
|
|
16072
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
16073
|
+
__decorate$1([
|
|
16074
|
+
assignmentClone
|
|
16075
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
16038
16076
|
__decorate$1([
|
|
16039
16077
|
assignmentClone
|
|
16040
16078
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -16052,7 +16090,9 @@
|
|
|
16052
16090
|
*/ SpriteMaskUpdateFlags;
|
|
16053
16091
|
(function(SpriteMaskUpdateFlags) {
|
|
16054
16092
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
16055
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
16093
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
16094
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
16095
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
16056
16096
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
16057
16097
|
/**
|
|
16058
16098
|
* Vertex element format.
|
|
@@ -16845,6 +16885,7 @@
|
|
|
16845
16885
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
16846
16886
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
16847
16887
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
16888
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
16848
16889
|
// @todo: should fix bug when dataChangedFlag is true
|
|
16849
16890
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
16850
16891
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -16862,7 +16903,7 @@
|
|
|
16862
16903
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
16863
16904
|
var storeInfo = storeInfos[i];
|
|
16864
16905
|
storeInfo || (storeInfos[i] = storeInfo = new Vector2());
|
|
16865
|
-
storeInfo.set(
|
|
16906
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
16866
16907
|
var deltaPositions = endFrame.deltaPositions;
|
|
16867
16908
|
for(var j = 0; j < vertexCount; j++){
|
|
16868
16909
|
var start = offset + bufferFloatStride * j;
|
|
@@ -18134,6 +18175,7 @@
|
|
|
18134
18175
|
var MeshRenderer = function MeshRenderer(entity) {
|
|
18135
18176
|
var _this;
|
|
18136
18177
|
_this = Renderer.call(this, entity) || this;
|
|
18178
|
+
_this._enableVertexColor = false;
|
|
18137
18179
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
18138
18180
|
return _this;
|
|
18139
18181
|
};
|
|
@@ -18179,7 +18221,7 @@
|
|
|
18179
18221
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
18180
18222
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
18181
18223
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
18182
|
-
shaderData.disableMacro(MeshRenderer.
|
|
18224
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
18183
18225
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
18184
18226
|
switch(vertexElements[i].semantic){
|
|
18185
18227
|
case "TEXCOORD_0":
|
|
@@ -18195,7 +18237,7 @@
|
|
|
18195
18237
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
18196
18238
|
break;
|
|
18197
18239
|
case "COLOR_0":
|
|
18198
|
-
shaderData.enableMacro(MeshRenderer.
|
|
18240
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
18199
18241
|
break;
|
|
18200
18242
|
}
|
|
18201
18243
|
}
|
|
@@ -18246,6 +18288,20 @@
|
|
|
18246
18288
|
this._setMesh(value);
|
|
18247
18289
|
}
|
|
18248
18290
|
}
|
|
18291
|
+
},
|
|
18292
|
+
{
|
|
18293
|
+
key: "enableVertexColor",
|
|
18294
|
+
get: /**
|
|
18295
|
+
* Whether enable vertex color.
|
|
18296
|
+
*/ function get() {
|
|
18297
|
+
return this._enableVertexColor;
|
|
18298
|
+
},
|
|
18299
|
+
set: function set(value) {
|
|
18300
|
+
if (value !== this._enableVertexColor) {
|
|
18301
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
18302
|
+
this._enableVertexColor = value;
|
|
18303
|
+
}
|
|
18304
|
+
}
|
|
18249
18305
|
}
|
|
18250
18306
|
]);
|
|
18251
18307
|
return MeshRenderer;
|
|
@@ -18263,7 +18319,7 @@
|
|
|
18263
18319
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
18264
18320
|
})();
|
|
18265
18321
|
(function() {
|
|
18266
|
-
MeshRenderer.
|
|
18322
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
18267
18323
|
})();
|
|
18268
18324
|
__decorate$1([
|
|
18269
18325
|
ignoreClone
|
|
@@ -19840,7 +19896,7 @@
|
|
|
19840
19896
|
// vertices
|
|
19841
19897
|
this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
19842
19898
|
// indices
|
|
19843
|
-
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
|
|
19899
|
+
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
|
|
19844
19900
|
mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
|
|
19845
19901
|
mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
|
|
19846
19902
|
mesh.setVertexElements(vertexElements);
|
|
@@ -22914,7 +22970,7 @@
|
|
|
22914
22970
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
22915
22971
|
})();
|
|
22916
22972
|
(function() {
|
|
22917
|
-
CascadedShadowCasterPass._viewport = new
|
|
22973
|
+
CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
|
|
22918
22974
|
})();
|
|
22919
22975
|
(function() {
|
|
22920
22976
|
CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
|
|
@@ -24960,8 +25016,10 @@
|
|
|
24960
25016
|
if (name === void 0) name = null;
|
|
24961
25017
|
var _this;
|
|
24962
25018
|
_this = ReferResource.call(this, engine) || this;
|
|
24963
|
-
_this.
|
|
24964
|
-
_this.
|
|
25019
|
+
_this._automaticWidth = 0;
|
|
25020
|
+
_this._automaticHeight = 0;
|
|
25021
|
+
_this._customWidth = undefined;
|
|
25022
|
+
_this._customHeight = undefined;
|
|
24965
25023
|
_this._positions = [
|
|
24966
25024
|
new Vector2(),
|
|
24967
25025
|
new Vector2(),
|
|
@@ -24982,7 +25040,7 @@
|
|
|
24982
25040
|
_this._region = new Rect(0, 0, 1, 1);
|
|
24983
25041
|
_this._pivot = new Vector2(0.5, 0.5);
|
|
24984
25042
|
_this._border = new Vector4(0, 0, 0, 0);
|
|
24985
|
-
_this._dirtyUpdateFlag =
|
|
25043
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
24986
25044
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
24987
25045
|
_this._texture = texture;
|
|
24988
25046
|
region && _this._region.copyFrom(region);
|
|
@@ -25031,9 +25089,12 @@
|
|
|
25031
25089
|
if (this._texture) {
|
|
25032
25090
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
25033
25091
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
25034
|
-
this.
|
|
25035
|
-
this.
|
|
25092
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
25093
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
25094
|
+
} else {
|
|
25095
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
25036
25096
|
}
|
|
25097
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
25037
25098
|
};
|
|
25038
25099
|
_proto._updatePositions = function _updatePositions() {
|
|
25039
25100
|
var blank = this._atlasRegionOffset;
|
|
@@ -25087,11 +25148,16 @@
|
|
|
25087
25148
|
};
|
|
25088
25149
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
25089
25150
|
switch(type){
|
|
25151
|
+
case SpriteModifyFlags.texture:
|
|
25152
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
25153
|
+
break;
|
|
25090
25154
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
25091
25155
|
case SpriteModifyFlags.region:
|
|
25092
|
-
this._dirtyUpdateFlag |=
|
|
25156
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
25093
25157
|
break;
|
|
25094
25158
|
case SpriteModifyFlags.atlasRegion:
|
|
25159
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
25160
|
+
break;
|
|
25095
25161
|
case SpriteModifyFlags.border:
|
|
25096
25162
|
this._dirtyUpdateFlag |= 0x2;
|
|
25097
25163
|
break;
|
|
@@ -25110,7 +25176,9 @@
|
|
|
25110
25176
|
if (this._texture !== value) {
|
|
25111
25177
|
this._texture = value;
|
|
25112
25178
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
25113
|
-
(this.
|
|
25179
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25180
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25181
|
+
}
|
|
25114
25182
|
}
|
|
25115
25183
|
}
|
|
25116
25184
|
},
|
|
@@ -25118,13 +25186,21 @@
|
|
|
25118
25186
|
key: "width",
|
|
25119
25187
|
get: /**
|
|
25120
25188
|
* The width of the sprite (in world coordinates).
|
|
25189
|
+
*
|
|
25190
|
+
* @remarks
|
|
25191
|
+
* If width is set, return the set value,
|
|
25192
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
25121
25193
|
*/ function get() {
|
|
25122
|
-
this.
|
|
25123
|
-
|
|
25194
|
+
if (this._customWidth !== undefined) {
|
|
25195
|
+
return this._customWidth;
|
|
25196
|
+
} else {
|
|
25197
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
25198
|
+
return this._automaticWidth;
|
|
25199
|
+
}
|
|
25124
25200
|
},
|
|
25125
25201
|
set: function set(value) {
|
|
25126
|
-
if (this.
|
|
25127
|
-
this.
|
|
25202
|
+
if (this._customWidth !== value) {
|
|
25203
|
+
this._customWidth = value;
|
|
25128
25204
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25129
25205
|
}
|
|
25130
25206
|
}
|
|
@@ -25133,13 +25209,21 @@
|
|
|
25133
25209
|
key: "height",
|
|
25134
25210
|
get: /**
|
|
25135
25211
|
* The height of the sprite (in world coordinates).
|
|
25212
|
+
*
|
|
25213
|
+
* @remarks
|
|
25214
|
+
* If height is set, return the set value,
|
|
25215
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
25136
25216
|
*/ function get() {
|
|
25137
|
-
this.
|
|
25138
|
-
|
|
25217
|
+
if (this._customHeight !== undefined) {
|
|
25218
|
+
return this._customHeight;
|
|
25219
|
+
} else {
|
|
25220
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
25221
|
+
return this._automaticHeight;
|
|
25222
|
+
}
|
|
25139
25223
|
},
|
|
25140
25224
|
set: function set(value) {
|
|
25141
|
-
if (this.
|
|
25142
|
-
this.
|
|
25225
|
+
if (this._customHeight !== value) {
|
|
25226
|
+
this._customHeight = value;
|
|
25143
25227
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25144
25228
|
}
|
|
25145
25229
|
}
|
|
@@ -25169,7 +25253,9 @@
|
|
|
25169
25253
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25170
25254
|
this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
25171
25255
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
25172
|
-
(this.
|
|
25256
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25257
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25258
|
+
}
|
|
25173
25259
|
}
|
|
25174
25260
|
},
|
|
25175
25261
|
{
|
|
@@ -25184,7 +25270,9 @@
|
|
|
25184
25270
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25185
25271
|
this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
|
|
25186
25272
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
25187
|
-
(this.
|
|
25273
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25274
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25275
|
+
}
|
|
25188
25276
|
}
|
|
25189
25277
|
},
|
|
25190
25278
|
{
|
|
@@ -25200,7 +25288,9 @@
|
|
|
25200
25288
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25201
25289
|
region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
25202
25290
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
25203
|
-
(this.
|
|
25291
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25292
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25293
|
+
}
|
|
25204
25294
|
}
|
|
25205
25295
|
},
|
|
25206
25296
|
{
|
|
@@ -25250,7 +25340,8 @@
|
|
|
25250
25340
|
(function(SpriteUpdateFlags) {
|
|
25251
25341
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
25252
25342
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
25253
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
25343
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
25344
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
25254
25345
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
25255
25346
|
var _SlicedSpriteAssembler;
|
|
25256
25347
|
var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
@@ -25738,8 +25829,10 @@
|
|
|
25738
25829
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
25739
25830
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
25740
25831
|
_this._sprite = null;
|
|
25741
|
-
_this.
|
|
25742
|
-
_this.
|
|
25832
|
+
_this._automaticWidth = 0;
|
|
25833
|
+
_this._automaticHeight = 0;
|
|
25834
|
+
_this._customWidth = undefined;
|
|
25835
|
+
_this._customHeight = undefined;
|
|
25743
25836
|
_this._flipX = false;
|
|
25744
25837
|
_this._flipY = false;
|
|
25745
25838
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -25757,6 +25850,7 @@
|
|
|
25757
25850
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
25758
25851
|
target._assembler.resetData(target);
|
|
25759
25852
|
target.sprite = this._sprite;
|
|
25853
|
+
target.drawMode = this._drawMode;
|
|
25760
25854
|
};
|
|
25761
25855
|
/**
|
|
25762
25856
|
* @internal
|
|
@@ -25767,12 +25861,11 @@
|
|
|
25767
25861
|
/**
|
|
25768
25862
|
* @internal
|
|
25769
25863
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
25770
|
-
|
|
25771
|
-
|
|
25864
|
+
if (this.sprite) {
|
|
25865
|
+
this._assembler.updatePositions(this);
|
|
25866
|
+
} else {
|
|
25772
25867
|
worldBounds.min.set(0, 0, 0);
|
|
25773
25868
|
worldBounds.max.set(0, 0, 0);
|
|
25774
|
-
} else {
|
|
25775
|
-
this._assembler.updatePositions(this);
|
|
25776
25869
|
}
|
|
25777
25870
|
};
|
|
25778
25871
|
/**
|
|
@@ -25782,17 +25875,17 @@
|
|
|
25782
25875
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
25783
25876
|
return;
|
|
25784
25877
|
}
|
|
25785
|
-
// Update position
|
|
25878
|
+
// Update position
|
|
25786
25879
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
25787
25880
|
this._assembler.updatePositions(this);
|
|
25788
25881
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
25789
25882
|
}
|
|
25790
|
-
// Update uv
|
|
25883
|
+
// Update uv
|
|
25791
25884
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
25792
25885
|
this._assembler.updateUVs(this);
|
|
25793
25886
|
this._dirtyUpdateFlag &= ~0x2;
|
|
25794
25887
|
}
|
|
25795
|
-
// Push
|
|
25888
|
+
// Push primitive
|
|
25796
25889
|
var material = this.getMaterial();
|
|
25797
25890
|
var texture = this.sprite.texture;
|
|
25798
25891
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -25810,6 +25903,16 @@
|
|
|
25810
25903
|
this._assembler = null;
|
|
25811
25904
|
this._verticesData = null;
|
|
25812
25905
|
};
|
|
25906
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
25907
|
+
var sprite = this._sprite;
|
|
25908
|
+
if (sprite) {
|
|
25909
|
+
this._automaticWidth = sprite.width;
|
|
25910
|
+
this._automaticHeight = sprite.height;
|
|
25911
|
+
} else {
|
|
25912
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
25913
|
+
}
|
|
25914
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
25915
|
+
};
|
|
25813
25916
|
_proto._updateStencilState = function _updateStencilState() {
|
|
25814
25917
|
// Update stencil.
|
|
25815
25918
|
var material = this.getInstanceMaterial();
|
|
@@ -25836,22 +25939,21 @@
|
|
|
25836
25939
|
break;
|
|
25837
25940
|
case SpriteModifyFlags.size:
|
|
25838
25941
|
var _this = this, drawMode = _this._drawMode;
|
|
25839
|
-
|
|
25942
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
25943
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
25840
25944
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25841
25945
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
25842
25946
|
this._dirtyUpdateFlag |= 0x3;
|
|
25843
25947
|
} else {
|
|
25844
25948
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
25845
25949
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
25846
|
-
if (this.
|
|
25950
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25847
25951
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25848
25952
|
}
|
|
25849
25953
|
}
|
|
25850
25954
|
break;
|
|
25851
25955
|
case SpriteModifyFlags.border:
|
|
25852
|
-
|
|
25853
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
25854
|
-
}
|
|
25956
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
25855
25957
|
break;
|
|
25856
25958
|
case SpriteModifyFlags.region:
|
|
25857
25959
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -25936,9 +26038,9 @@
|
|
|
25936
26038
|
var lastSprite = this._sprite;
|
|
25937
26039
|
if (lastSprite !== value) {
|
|
25938
26040
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
26041
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
25939
26042
|
if (value) {
|
|
25940
26043
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
25941
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
25942
26044
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
25943
26045
|
} else {
|
|
25944
26046
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -25963,16 +26065,22 @@
|
|
|
25963
26065
|
{
|
|
25964
26066
|
key: "width",
|
|
25965
26067
|
get: /**
|
|
25966
|
-
* Render width.
|
|
26068
|
+
* Render width (in world coordinates).
|
|
26069
|
+
*
|
|
26070
|
+
* @remarks
|
|
26071
|
+
* If width is set, return the set value,
|
|
26072
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
25967
26073
|
*/ function get() {
|
|
25968
|
-
|
|
25969
|
-
|
|
26074
|
+
if (this._customWidth !== undefined) {
|
|
26075
|
+
return this._customWidth;
|
|
26076
|
+
} else {
|
|
26077
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
26078
|
+
return this._automaticWidth;
|
|
26079
|
+
}
|
|
25970
26080
|
},
|
|
25971
26081
|
set: function set(value) {
|
|
25972
|
-
|
|
25973
|
-
|
|
25974
|
-
if (this._width !== value) {
|
|
25975
|
-
this._width = value;
|
|
26082
|
+
if (this._customWidth !== value) {
|
|
26083
|
+
this._customWidth = value;
|
|
25976
26084
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25977
26085
|
}
|
|
25978
26086
|
}
|
|
@@ -25980,16 +26088,22 @@
|
|
|
25980
26088
|
{
|
|
25981
26089
|
key: "height",
|
|
25982
26090
|
get: /**
|
|
25983
|
-
* Render height.
|
|
26091
|
+
* Render height (in world coordinates).
|
|
26092
|
+
*
|
|
26093
|
+
* @remarks
|
|
26094
|
+
* If height is set, return the set value,
|
|
26095
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
25984
26096
|
*/ function get() {
|
|
25985
|
-
|
|
25986
|
-
|
|
26097
|
+
if (this._customHeight !== undefined) {
|
|
26098
|
+
return this._customHeight;
|
|
26099
|
+
} else {
|
|
26100
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
26101
|
+
return this._automaticHeight;
|
|
26102
|
+
}
|
|
25987
26103
|
},
|
|
25988
26104
|
set: function set(value) {
|
|
25989
|
-
|
|
25990
|
-
|
|
25991
|
-
if (this._height !== value) {
|
|
25992
|
-
this._height = value;
|
|
26105
|
+
if (this._customHeight !== value) {
|
|
26106
|
+
this._customHeight = value;
|
|
25993
26107
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25994
26108
|
}
|
|
25995
26109
|
}
|
|
@@ -26076,10 +26190,16 @@
|
|
|
26076
26190
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
26077
26191
|
__decorate$1([
|
|
26078
26192
|
ignoreClone
|
|
26079
|
-
], SpriteRenderer.prototype, "
|
|
26193
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
26080
26194
|
__decorate$1([
|
|
26081
26195
|
ignoreClone
|
|
26082
|
-
], SpriteRenderer.prototype, "
|
|
26196
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
26197
|
+
__decorate$1([
|
|
26198
|
+
assignmentClone
|
|
26199
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
26200
|
+
__decorate$1([
|
|
26201
|
+
assignmentClone
|
|
26202
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
26083
26203
|
__decorate$1([
|
|
26084
26204
|
assignmentClone
|
|
26085
26205
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -26100,7 +26220,9 @@
|
|
|
26100
26220
|
*/ SpriteRendererUpdateFlags;
|
|
26101
26221
|
(function(SpriteRendererUpdateFlags) {
|
|
26102
26222
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
26103
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
26223
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
26224
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
26225
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
26104
26226
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
26105
26227
|
/**
|
|
26106
26228
|
* @internal
|
|
@@ -33378,6 +33500,12 @@
|
|
|
33378
33500
|
this.vertexBuffers = [];
|
|
33379
33501
|
this.blendShapes = [];
|
|
33380
33502
|
};
|
|
33503
|
+
/**
|
|
33504
|
+
* @internal
|
|
33505
|
+
*/ var BufferRestoreInfo = function BufferRestoreInfo(buffer, data) {
|
|
33506
|
+
this.buffer = buffer;
|
|
33507
|
+
this.data = data;
|
|
33508
|
+
};
|
|
33381
33509
|
/**
|
|
33382
33510
|
* @internal
|
|
33383
33511
|
*/ var BufferDataRestoreInfo = function BufferDataRestoreInfo(main, typeSize, sparseCount, sparseIndices, sparseValues) {
|
|
@@ -34713,6 +34841,7 @@
|
|
|
34713
34841
|
vertexBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, vertices.byteLength, exports.BufferUsage.Static);
|
|
34714
34842
|
vertexBuffer.setData(vertices);
|
|
34715
34843
|
accessorBuffer.vertexBuffer = vertexBuffer;
|
|
34844
|
+
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer, accessorBuffer.restoreInfo));
|
|
34716
34845
|
}
|
|
34717
34846
|
mesh.setVertexBufferBinding(vertexBuffer, stride, bufferBindIndex);
|
|
34718
34847
|
vertexBindingInfos[meshId] = bufferBindIndex++;
|
|
@@ -34724,6 +34853,7 @@
|
|
|
34724
34853
|
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
34725
34854
|
var vertexBuffer1 = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, vertices.byteLength, exports.BufferUsage.Static);
|
|
34726
34855
|
vertexBuffer1.setData(vertices);
|
|
34856
|
+
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer1, accessorBuffer.restoreInfo));
|
|
34727
34857
|
mesh.setVertexBufferBinding(vertexBuffer1, accessorBuffer.stride, bufferBindIndex);
|
|
34728
34858
|
vertexBindingInfos[meshId] = bufferBindIndex++;
|
|
34729
34859
|
}
|
|
@@ -34895,14 +35025,7 @@
|
|
|
34895
35025
|
camera.enabled = false;
|
|
34896
35026
|
};
|
|
34897
35027
|
_proto._createRenderer = function _createRenderer(context, glTFNode, entity) {
|
|
34898
|
-
var
|
|
34899
|
-
var glTFMeshes = glTF.meshes;
|
|
34900
|
-
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
34901
|
-
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
34902
|
-
var glTFMesh = glTFMeshes[meshID];
|
|
34903
|
-
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
34904
|
-
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
34905
|
-
for(var i = 0; i < glTFMeshPrimitives.length; i++){
|
|
35028
|
+
var _loop = function _loop(i) {
|
|
34906
35029
|
var gltfPrimitive = glTFMeshPrimitives[i];
|
|
34907
35030
|
var mesh = meshes[meshID][i];
|
|
34908
35031
|
var renderer = void 0;
|
|
@@ -34924,8 +35047,22 @@
|
|
|
34924
35047
|
var materialIndex = gltfPrimitive.material;
|
|
34925
35048
|
var material = (materials == null ? void 0 : materials[materialIndex]) || GLTFSceneParser._getDefaultMaterial(engine);
|
|
34926
35049
|
renderer.setMaterial(material);
|
|
35050
|
+
// Enable vertex color if mesh has COLOR_0 vertex element
|
|
35051
|
+
mesh.vertexElements.forEach(function(element) {
|
|
35052
|
+
if (element.semantic === "COLOR_0") {
|
|
35053
|
+
renderer.enableVertexColor = true;
|
|
35054
|
+
}
|
|
35055
|
+
});
|
|
34927
35056
|
GLTFParser.executeExtensionsAdditiveAndParse(gltfPrimitive.extensions, context, renderer, gltfPrimitive);
|
|
34928
|
-
}
|
|
35057
|
+
};
|
|
35058
|
+
var glTFResource = context.glTFResource, glTF = context.glTF;
|
|
35059
|
+
var glTFMeshes = glTF.meshes;
|
|
35060
|
+
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
35061
|
+
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
35062
|
+
var glTFMesh = glTFMeshes[meshID];
|
|
35063
|
+
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
35064
|
+
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
35065
|
+
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
34929
35066
|
};
|
|
34930
35067
|
_proto._createAnimator = function _createAnimator(context) {
|
|
34931
35068
|
if (!context.hasSkinned && !context.glTFResource.animations) {
|
|
@@ -36945,7 +37082,7 @@
|
|
|
36945
37082
|
var atlasItem = atlasItems[i];
|
|
36946
37083
|
if (atlasItem.img) {
|
|
36947
37084
|
chainPromises.push(resourceManager.load({
|
|
36948
|
-
url: atlasItem.img,
|
|
37085
|
+
url: Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
36949
37086
|
type: exports.AssetType.Texture2D,
|
|
36950
37087
|
params: {
|
|
36951
37088
|
format: format,
|
|
@@ -37672,7 +37809,7 @@
|
|
|
37672
37809
|
], GALACEAN_animation_event);
|
|
37673
37810
|
|
|
37674
37811
|
//@ts-ignore
|
|
37675
|
-
var version = "1.0.0-beta.
|
|
37812
|
+
var version = "1.0.0-beta.8";
|
|
37676
37813
|
console.log("Galacean engine version: " + version);
|
|
37677
37814
|
for(var key in CoreObjects){
|
|
37678
37815
|
Loader.registerClass(key, CoreObjects[key]);
|