219mze 发表于 2024-10-6 10:03:10

求助:threejs+qml+json模型加载失败


    <div style="color: black; text-align: left; margin-bottom: 10px;">Starting C:\Qt\Qt5.6.2\Examples\Qt-5.6\canvas3d\build-threejs-Desktop_Qt_5_6_2_MinGW_32bit-Debug\cellphone\debug\cellphone.exe...
      QML debugging is enabled. Only use this in a safe environment.
      Debug: THREE.Canvas3DRenderer 71 (qrc:/three.js:29042, )
      Warning: QOpenGLShader::compile(Vertex): ERROR: 3:217: : array size must be a positive integer
      (opengl\qopenglshaderprogram.cpp:328, bool QOpenGLShaderPrivate::compile(QOpenGLShader*))
      Warning: *** Problematic Vertex shader source code *** (opengl\qopenglshaderprogram.cpp:334, bool QOpenGLShaderPrivate::compile(QOpenGLShader*))
      Warning: #version 120
      #define lowp
      #define mediump
      #define highp
      #line 2
      #define precision
      precision highp float;
      precision highp int;
      #define VERTEX_TEXTURES
      #define GAMMA_FACTOR 2
      #define MAX_DIR_LIGHTS 1
      #define MAX_POINT_LIGHTS 0
      #define MAX_SPOT_LIGHTS 0
      #define MAX_HEMI_LIGHTS 0
      #define MAX_SHADOWS 0
      #define MAX_BONES 0
      #define USE_COLOR
      #define USE_SKINNING
      uniform mat4 modelMatrix;
      uniform mat4 modelViewMatrix;
      uniform mat4 projectionMatrix;
      uniform mat4 viewMatrix;
      uniform mat3 normalMatrix;
      uniform vec3 cameraPosition;
      attribute vec3 position;
      attribute vec3 normal;
      attribute vec2 uv;
      attribute vec2 uv2;
      #ifdef USE_COLOR
      attribute vec3 color;
      #endif
      #ifdef USE_MORPHTARGETS
      attribute vec3 morphTarget0;
      attribute vec3 morphTarget1;
      attribute vec3 morphTarget2;
      attribute vec3 morphTarget3;
      #ifdef USE_MORPHNORMALS
      attribute vec3 morphNormal0;
      attribute vec3 morphNormal1;
      attribute vec3 morphNormal2;
      attribute vec3 morphNormal3;
      #else
      attribute vec3 morphTarget4;
      attribute vec3 morphTarget5;
      attribute vec3 morphTarget6;
      attribute vec3 morphTarget7;
      #endif
      #endif
      #ifdef USE_SKINNING
      attribute vec4 skinIndex;
      attribute vec4 skinWeight;
      #endif
      #define PHONG
      varying vec3 vViewPosition;
      #ifndef FLAT_SHADED
      varying vec3 vNormal;
      #endif
      #define PI 3.14159
      #define PI2 6.28318
      #define RECIPROCAL_PI2 0.15915494
      #define LOG2 1.442695
      #define EPSILON 1e-6
      float square( in float a ) { return a*a; }
      vec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }
      vec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }
      vec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }
      float saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }
      vec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }
      vec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }
      vec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }
      float average( in float a ) { return a; }
      float average( in vec2 a ) { return ( a.x + a.y) * 0.5; }
      float average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }
      float average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }
      float whiteCompliment( in float a ) { return saturate( 1.0 - a ); }
      vec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }
      vec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }
      vec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }
      vec3 transformDirection( in vec3 normal, in mat4 matrix ) {
      return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );
      }
      // http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations
      vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
      return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );
      }
      vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {
      float distance = dot( planeNormal, point-pointOnPlane );
      return point - distance * planeNormal;
      }
      float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
      return sign( dot( point - pointOnPlane, planeNormal ) );
      }
      vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
      return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );
      }
      float calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {
      if ( decayExponent &gt; 0.0 ) {
      return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );
      }
      return 1.0;
      }
      vec3 inputToLinear( in vec3 a ) {
      #ifdef GAMMA_INPUT
      return pow( a, vec3( float( GAMMA_FACTOR ) ) );
      #else
      return a;
      #endif
      }
      vec3 linearToOutput( in vec3 a ) {
      #ifdef GAMMA_OUTPUT
      return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );
      #else
      return a;
      #endif
      }
      #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
      varying vec2 vUv;
      uniform vec4 offsetRepeat;
      #endif
      #ifdef USE_LIGHTMAP
      varying vec2 vUv2;
      #endif
      #if defined( USE_ENVMAP ) &amp;&amp; ! defined( USE_BUMPMAP ) &amp;&amp; ! defined( USE_NORMALMAP ) &amp;&amp; ! defined( PHONG )
      varying vec3 vReflect;
      uniform float refractionRatio;
      #endif
      #if MAX_SPOT_LIGHTS &gt; 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
      varying vec3 vWorldPosition;
      #endif
      #ifdef USE_COLOR
      varying vec3 vColor;
      #endif
      #ifdef USE_MORPHTARGETS
      #ifndef USE_MORPHNORMALS
      uniform float morphTargetInfluences[ 8 ];
      #else
      uniform float morphTargetInfluences[ 4 ];
      #endif
      #endif
      #ifdef USE_SKINNING
      uniform mat4 bindMatrix;
      uniform mat4 bindMatrixInverse;
      #ifdef BONE_TEXTURE
      uniform sampler2D boneTexture;
      uniform int boneTextureWidth;
      uniform int boneTextureHeight;
      mat4 getBoneMatrix( const in float i ) {
      float j = i * 4.0;
      float x = mod( j, float( boneTextureWidth ) );
      float y = floor( j / float( boneTextureWidth ) );
      float dx = 1.0 / float( boneTextureWidth );
      float dy = 1.0 / float( boneTextureHeight );
      y = dy * ( y + 0.5 );
      vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
      vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
      vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
      vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
      mat4 bone = mat4( v1, v2, v3, v4 );
      return bone;
      }
      #else
      uniform mat4 boneGlobalMatrices[ MAX_BONES ];
      mat4 getBoneMatrix( const in float i ) {
      mat4 bone = boneGlobalMatrices[ int(i) ];
      return bone;
      }
      #endif
      #endif
      #ifdef USE_SHADOWMAP
      varying vec4 vShadowCoord[ MAX_SHADOWS ];
      uniform mat4 shadowMatrix[ MAX_SHADOWS ];
      #endif
      #ifdef USE_LOGDEPTHBUF
      #ifdef USE_LOGDEPTHBUF_EXT
      varying float vFragDepth;
      #endif
      uniform float logDepthBufFC;
      #endif
      void main() {
      #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
      vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
      #endif
      #ifdef USE_LIGHTMAP
      vUv2 = uv2;
      #endif
      #ifdef USE_COLOR
      vColor.xyz = inputToLinear( color.xyz );
      #endif
      #ifdef USE_MORPHNORMALS
      vec3 morphedNormal = vec3( 0.0 );
      morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
      morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
      morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
      morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
      morphedNormal += normal;
      #endif
      #ifdef USE_SKINNING
      mat4 boneMatX = getBoneMatrix( skinIndex.x );
      mat4 boneMatY = getBoneMatrix( skinIndex.y );
      mat4 boneMatZ = getBoneMatrix( skinIndex.z );
      mat4 boneMatW = getBoneMatrix( skinIndex.w );
      #endif
      #ifdef USE_SKINNING
      mat4 skinMatrix = mat4( 0.0 );
      skinMatrix += skinWeight.x * boneMatX;
      skinMatrix += skinWeight.y * boneMatY;
      skinMatrix += skinWeight.z * boneMatZ;
      skinMatrix += skinWeight.w * boneMatW;
      skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
      #ifdef USE_MORPHNORMALS
      vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );
      #else
      vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );
      #endif
      #endif
      #ifdef USE_SKINNING
      vec3 objectNormal = skinnedNormal.xyz;
      #elif defined( USE_MORPHNORMALS )
      vec3 objectNormal = morphedNormal;
      #else
      vec3 objectNormal = normal;
      #endif
      #ifdef FLIP_SIDED
      objectNormal = -objectNormal;
      #endif
      vec3 transformedNormal = normalMatrix * objectNormal;
      #ifndef FLAT_SHADED
      vNormal = normalize( transformedNormal );
      #endif
      #ifdef USE_MORPHTARGETS
      vec3 morphed = vec3( 0.0 );
      morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
      morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
      morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
      morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
      #ifndef USE_MORPHNORMALS
      morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
      morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
      morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
      morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
      #endif
      morphed += position;
      #endif
      #ifdef USE_SKINNING
      #ifdef USE_MORPHTARGETS
      vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );
      #else
      vec4 skinVertex = bindMatrix * vec4( position, 1.0 );
      #endif
      vec4 skinned = vec4( 0.0 );
      skinned += boneMatX * skinVertex * skinWeight.x;
      skinned += boneMatY * skinVertex * skinWeight.y;
      skinned += boneMatZ * skinVertex * skinWeight.z;
      skinned += boneMatW * skinVertex * skinWeight.w;
      skinned = bindMatrixInverse * skinned;
      #endif
      #ifdef USE_SKINNING
      vec4 mvPosition = modelViewMatrix * skinned;
      #elif defined( USE_MORPHTARGETS )
      vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );
      #else
      vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
      #endif
      gl_Position = projectionMatrix * mvPosition;
      #ifdef USE_LOGDEPTHBUF
      gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
      #ifdef USE_LOGDEPTHBUF_EXT
      vFragDepth = 1.0 + gl_Position.w;
      #else
      gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
      #endif
      #endif
      vViewPosition = -mvPosition.xyz;
      #if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
      #ifdef USE_SKINNING
      vec4 worldPosition = modelMatrix * skinned;
      #elif defined( USE_MORPHTARGETS )
      vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );
      #else
      vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
      #endif
      #endif
      #if defined( USE_ENVMAP ) &amp;&amp; ! defined( USE_BUMPMAP ) &amp;&amp; ! defined( USE_NORMALMAP ) &amp;&amp; ! defined( PHONG )
      vec3 worldNormal = transformDirection( objectNormal, modelMatrix );
      vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
      #ifdef ENVMAP_MODE_REFLECTION
      vReflect = reflect( cameraToVertex, worldNormal );
      #else
      vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
      #endif
      #endif
      #if MAX_SPOT_LIGHTS &gt; 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
      vWorldPosition = worldPosition.xyz;
      #endif
      #ifdef USE_SHADOWMAP
      for( int i = 0; i &lt; MAX_SHADOWS; i ++ ) {
      vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
      }
      #endif
      } (opengl\qopenglshaderprogram.cpp:335, bool QOpenGLShaderPrivate::compile(QOpenGLShader*))
      Warning: *** (opengl\qopenglshaderprogram.cpp:336, bool QOpenGLShaderPrivate::compile(QOpenGLShader*))
      Warning: CanvasRenderer::executeCommandQueue: Failed to compile shader QOpenGLShader(0x2f6756f0) (canvasrenderer.cpp:1063, void QtCanvas3D::CanvasRenderer::executeCommandQueue())
      Critical: THREE.WebGLShader: Shader couldnt compile. (qrc:/three.js:69, )
      Warning: THREE.WebGLShader: gl.getShaderInfoLog() ERROR: 3:217: : array size must be a positive integer
      1: precision highp float;
      2: precision highp int;
      3:
      4: #define VERTEX_TEXTURES
      5:
      6:
      7: #define GAMMA_FACTOR 2
      8: #define MAX_DIR_LIGHTS 1
      9: #define MAX_POINT_LIGHTS 0
      10: #define MAX_SPOT_LIGHTS 0
      11: #define MAX_HEMI_LIGHTS 0
      12: #define MAX_SHADOWS 0
      13: #define MAX_BONES 0
      14:
      15:
      16:
      17:
      18:
      19:
      20:
      21:
      22: #define USE_COLOR
      23:
      24: #define USE_SKINNING
      25:
      26:
      27:
      28:
      29:
      30:
      31:
      32:
      33:
      34:
      35:
      36:
      37: uniform mat4 modelMatrix;
      38: uniform mat4 modelViewMatrix;
      39: uniform mat4 projectionMatrix;
      40: uniform mat4 viewMatrix;
      41: uniform mat3 normalMatrix;
      42: uniform vec3 cameraPosition;
      43: attribute vec3 position;
      44: attribute vec3 normal;
      45: attribute vec2 uv;
      46: attribute vec2 uv2;
      47: #ifdef USE_COLOR
      48: attribute vec3 color;
      49: #endif
      50: #ifdef USE_MORPHTARGETS
      51: attribute vec3 morphTarget0;
      52: attribute vec3 morphTarget1;
      53: attribute vec3 morphTarget2;
      54: attribute vec3 morphTarget3;
      55: #ifdef USE_MORPHNORMALS
      56: attribute vec3 morphNormal0;
      57: attribute vec3 morphNormal1;
      58: attribute vec3 morphNormal2;
      59: attribute vec3 morphNormal3;
      60: #else
      61: attribute vec3 morphTarget4;
      62: attribute vec3 morphTarget5;
      63: attribute vec3 morphTarget6;
      64: attribute vec3 morphTarget7;
      65: #endif
      66: #endif
      67: #ifdef USE_SKINNING
      68: attribute vec4 skinIndex;
      69: attribute vec4 skinWeight;
      70: #endif
      71: #define PHONG
      72: varying vec3 vViewPosition;
      73: #ifndef FLAT_SHADED
      74: varying vec3 vNormal;
      75: #endif
      76: #define PI 3.14159
      77: #define PI2 6.28318
      78: #define RECIPROCAL_PI2 0.15915494
      79: #define LOG2 1.442695
      80: #define EPSILON 1e-6
      81:
      82: float square( in float a ) { return a*a; }
      83: vec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }
      84: vec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }
      85: vec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }
      86: float saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }
      87: vec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }
      88: vec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }
      89: vec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }
      90: float average( in float a ) { return a; }
      91: float average( in vec2 a ) { return ( a.x + a.y) * 0.5; }
      92: float average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }
      93: float average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }
      94: float whiteCompliment( in float a ) { return saturate( 1.0 - a ); }
      95: vec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }
      96: vec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }
      97: vec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }
      98: vec3 transformDirection( in vec3 normal, in mat4 matrix ) {
      99: return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );
      100: }
      101: // http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations
      102: vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
      103: return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );
      104: }
      105: vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {
      106: float distance = dot( planeNormal, point-pointOnPlane );
      107: return point - distance * planeNormal;
      108: }
      109: float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
      110: return sign( dot( point - pointOnPlane, planeNormal ) );
      111: }
      112: vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
      113: return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );
      114: }
      115: float calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {
      116: if ( decayExponent &gt; 0.0 ) {
      117: return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );
      118: }
      119: return 1.0;
      120: }
      121:
      122: vec3 inputToLinear( in vec3 a ) {
      123: #ifdef GAMMA_INPUT
      124: return pow( a, vec3( float( GAMMA_FACTOR ) ) );
      125: #else
      126: return a;
      127: #endif
      128: }
      129: vec3 linearToOutput( in vec3 a ) {
      130: #ifdef GAMMA_OUTPUT
      131: return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );
      132: #else
      133: return a;
      134: #endif
      135: }
      136:
      137: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
      138:
      139: varying vec2 vUv;
      140: uniform vec4 offsetRepeat;
      141:
      142: #endif
      143:
      144: #ifdef USE_LIGHTMAP
      145:
      146: varying vec2 vUv2;
      147:
      148: #endif
      149: #if defined( USE_ENVMAP ) &amp;&amp; ! defined( USE_BUMPMAP ) &amp;&amp; ! defined( USE_NORMALMAP ) &amp;&amp; ! defined( PHONG )
      150:
      151: varying vec3 vReflect;
      152:
      153: uniform float refractionRatio;
      154:
      155: #endif
      156:
      157: #if MAX_SPOT_LIGHTS &gt; 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
      158:
      159: varying vec3 vWorldPosition;
      160:
      161: #endif
      162:
      163: #ifdef USE_COLOR
      164:
      165: varying vec3 vColor;
      166:
      167: #endif
      168: #ifdef USE_MORPHTARGETS
      169:
      170: #ifndef USE_MORPHNORMALS
      171:
      172: uniform float morphTargetInfluences[ 8 ];
      173:
      174: #else
      175:
      176: uniform float morphTargetInfluences[ 4 ];
      177:
      178: #endif
      179:
      180: #endif
      181: #ifdef USE_SKINNING
      182:
      183: uniform mat4 bindMatrix;
      184: uniform mat4 bindMatrixInverse;
      185:
      186: #ifdef BONE_TEXTURE
      187:
      188: uniform sampler2D boneTexture;
      189: uniform int boneTextureWidth;
      190: uniform int boneTextureHeight;
      191:
      192: mat4 getBoneMatrix( const in float i ) {
      193:
      194: float j = i * 4.0;
      195: float x = mod( j, float( boneTextureWidth ) );
      196: float y = floor( j / float( boneTextureWidth ) );
      197:
      198: float dx = 1.0 / float( boneTextureWidth );
      199: float dy = 1.0 / float( boneTextureHeight );
      200:
      201: y = dy * ( y + 0.5 );
      202:
      203: vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
      204: vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
      205: vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
      206: vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
      207:
      208: mat4 bone = mat4( v1, v2, v3, v4 );
      209:
      210: return bone;
      211:
      212: }
      213:
      214: #else
      215:
      216: uniform mat4 boneGlobalMatrices[ MAX_BONES ];
      217:
      218: mat4 getBoneMatrix( const in float i ) {
      219:
      220: mat4 bone = boneGlobalMatrices[ int(i) ];
      221: return bone;
      222:
      223: }
      224:
      225: #endif
      226:
      227: #endif
      228:
      229: #ifdef USE_SHADOWMAP
      230:
      231: varying vec4 vShadowCoord[ MAX_SHADOWS ];
      232: uniform mat4 shadowMatrix[ MAX_SHADOWS ];
      233:
      234: #endif
      235: #ifdef USE_LOGDEPTHBUF
      236:
      237: #ifdef USE_LOGDEPTHBUF_EXT
      238:
      239: varying float vFragDepth;
      240:
      241: #endif
      242:
      243: uniform float logDepthBufFC;
      244:
      245: #endif
      246: void main() {
      247: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
      248:
      249: vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
      250:
      251: #endif
      252: #ifdef USE_LIGHTMAP
      253:
      254: vUv2 = uv2;
      255:
      256: #endif
      257: #ifdef USE_COLOR
      258:
      259: vColor.xyz = inputToLinear( color.xyz );
      260:
      261: #endif
      262: #ifdef USE_MORPHNORMALS
      263:
      264: vec3 morphedNormal = vec3( 0.0 );
      265:
      266: morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
      267: morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
      268: morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
      269: morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
      270:
      271: morphedNormal += normal;
      272:
      273: #endif
      274: #ifdef USE_SKINNING
      275:
      276: mat4 boneMatX = getBoneMatrix( skinIndex.x );
      277: mat4 boneMatY = getBoneMatrix( skinIndex.y );
      278: mat4 boneMatZ = getBoneMatrix( skinIndex.z );
      279: mat4 boneMatW = getBoneMatrix( skinIndex.w );
      280:
      281: #endif
      282: #ifdef USE_SKINNING
      283:
      284: mat4 skinMatrix = mat4( 0.0 );
      285: skinMatrix += skinWeight.x * boneMatX;
      286: skinMatrix += skinWeight.y * boneMatY;
      287: skinMatrix += skinWeight.z * boneMatZ;
      288: skinMatrix += skinWeight.w * boneMatW;
      289: skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
      290:
      291: #ifdef USE_MORPHNORMALS
      292:
      293: vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );
      294:
      295: #else
      296:
      297: vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );
      298:
      299: #endif
      300:
      301: #endif
      302:
      303: #ifdef USE_SKINNING
      304:
      305: vec3 objectNormal = skinnedNormal.xyz;
      306:
      307: #elif defined( USE_MORPHNORMALS )
      308:
      309: vec3 objectNormal = morphedNormal;
      310:
      311: #else
      312:
      313: vec3 objectNormal = normal;
      314:
      315: #endif
      316:
      317: #ifdef FLIP_SIDED
      318:
      319: objectNormal = -objectNormal;
      320:
      321: #endif
      322:
      323: vec3 transformedNormal = normalMatrix * objectNormal;
      324:
      325: #ifndef FLAT_SHADED
      326: vNormal = normalize( transformedNormal );
      327: #endif
      328: #ifdef USE_MORPHTARGETS
      329:
      330: vec3 morphed = vec3( 0.0 );
      331: morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
      332: morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
      333: morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
      334: morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
      335:
      336: #ifndef USE_MORPHNORMALS
      337:
      338: morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
      339: morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
      340: morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
      341: morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
      342:
      343: #endif
      344:
      345: morphed += position;
      346:
      347: #endif
      348: #ifdef USE_SKINNING
      349:
      350: #ifdef USE_MORPHTARGETS
      351:
      352: vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );
      353:
      354: #else
      355:
      356: vec4 skinVertex = bindMatrix * vec4( position, 1.0 );
      357:
      358: #endif
      359:
      360: vec4 skinned = vec4( 0.0 );
      361: skinned += boneMatX * skinVertex * skinWeight.x;
      362: skinned += boneMatY * skinVertex * skinWeight.y;
      363: skinned += boneMatZ * skinVertex * skinWeight.z;
      364: skinned += boneMatW * skinVertex * skinWeight.w;
      365: skinned = bindMatrixInverse * skinned;
      366:
      367: #endif
      368:
      369: #ifdef USE_SKINNING
      370:
      371: vec4 mvPosition = modelViewMatrix * skinned;
      372:
      373: #elif defined( USE_MORPHTARGETS )
      374:
      375: vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );
      376:
      377: #else
      378:
      379: vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
      380:
      381: #endif
      382:
      383: gl_Position = projectionMatrix * mvPosition;
      384:
      385: #ifdef USE_LOGDEPTHBUF
      386:
      387: gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
      388:
      389: #ifdef USE_LOGDEPTHBUF_EXT
      390:
      391: vFragDepth = 1.0 + gl_Position.w;
      392:
      393: #else
      394:
      395: gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
      396:
      397: #endif
      398:
      399: #endif
      400: vViewPosition = -mvPosition.xyz;
      401: #if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
      402:
      403: #ifdef USE_SKINNING
      404:
      405: vec4 worldPosition = modelMatrix * skinned;
      406:
      407: #elif defined( USE_MORPHTARGETS )
      408:
      409: vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );
      410:
      411: #else
      412:
      413: vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
      414:
      415: #endif
      416:
      417: #endif
      418:
      419: #if defined( USE_ENVMAP ) &amp;&amp; ! defined( USE_BUMPMAP ) &amp;&amp; ! defined( USE_NORMALMAP ) &amp;&amp; ! defined( PHONG )
      420:
      421: vec3 worldNormal = transformDirection( objectNormal, modelMatrix );
      422:
      423: vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
      424:
      425: #ifdef ENVMAP_MODE_REFLECTION
      426:
      427: vReflect = reflect( cameraToVertex, worldNormal );
      428:
      429: #else
      430:
      431: vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
      432:
      433: #endif
      434:
      435: #endif
      436:
      437: #if MAX_SPOT_LIGHTS &gt; 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
      438:
      439: vWorldPosition = worldPosition.xyz;
      440:
      441: #endif
      442: #ifdef USE_SHADOWMAP
      443:
      444: for( int i = 0; i &lt; MAX_SHADOWS; i ++ ) {
      445:
      446: vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
      447:
      448: }
      449:
      450: #endif
      451: } (qrc:/three.js:68, )
      Warning: QOpenGLShader::link: "Attached vertex shader is not compiled.\n" (opengl\qopenglshaderprogram.cpp:1049, virtual bool QOpenGLShaderProgram::link())
      Warning: CanvasRenderer::executeCommandQueue: Failed to link program: QOpenGLShaderProgram(0x2f6746a0) (canvasrenderer.cpp:1252, void QtCanvas3D::CanvasRenderer::executeCommandQueue())
      Critical: THREE.WebGLProgram: shader error: 1281 gl.VALIDATE_STATUS false gl.getPRogramInfoLog Attached vertex shader is not compiled.
      (qrc:/three.js:69, )
      Warning: THREE.WebGLProgram: gl.getProgramInfoLog()Attached vertex shader is not compiled.
      (qrc:/three.js:68, )
      Warning: QOpenGLShaderProgram::uniformLocation( viewMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( modelViewMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( projectionMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( normalMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( modelMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( cameraPosition ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( morphTargetInfluences ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( bindMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( bindMatrixInverse ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( boneGlobalMatrices ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( alphaMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( diffuse ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( envMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( flipEnvMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( lightMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( map ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( morphTargetInfluences ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( offsetRepeat ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( reflectivity ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( refractionRatio ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( specularMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( bumpMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( bumpScale ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( normalMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( normalScale ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( fogColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( fogDensity ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( fogFar ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( fogNear ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( ambientLightColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( directionalLightColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( directionalLightDirection ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( hemisphereLightDirection ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( hemisphereLightGroundColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( hemisphereLightSkyColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( pointLightColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( pointLightDecay ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( pointLightDistance ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( pointLightPosition ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightAngleCos ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightColor ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightDecay ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightDirection ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightDistance ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightExponent ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( spotLightPosition ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( shadowBias ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( shadowDarkness ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( shadowMap ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( shadowMapSize ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( shadowMatrix ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( emissive ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( shininess ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( specular ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::uniformLocation( wrapRGB ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1890, int QOpenGLShaderProgram::uniformLocation(const char*) const)
      Warning: QOpenGLShaderProgram::attributeLocation( position ): shader program is not linked (opengl\qopenglshaderprogram.cpp:1214, int QOpenGLShaderProgram::attributeLocation(const char*) const)
      Warning: CanvasRenderer::bindCurrentRenderTarget: OpenGL ERROR: 1282 (canvasrenderer.cpp:639, bool QtCanvas3D::CanvasRenderer::updateGlError(const char*))<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">以上</span>是问题日志输出,<span style="color: black;">因为</span>在独立显卡的openlg4.1版本运行正常,opengl4.0版本的平板运行失败,<span style="color: black;">日前</span>平板的集显,opengl4.0,windows10,很无奈,不<span style="color: black;">晓得</span><span style="color: black;">为何</span><span style="color: black;">期盼</span>有大神能够指点迷津。模型<span style="color: black;">运用</span>blender转json,io_three多个版本都实验的,不成功。</p>
      <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/1538984005081ac459a7e78~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728358225&amp;x-signature=Gyr0Flq6lifxdrd9hK8roggkz3k%3D" style="width: 50%; margin-bottom: 20px;"></div>
    </div>




7wu1wm0 发表于 2024-10-27 10:48:13

谢谢、感谢、感恩、辛苦了、有你真好等。

4zhvml8 发表于 6 天前

感谢你的精彩评论,为我的思绪打开了新的窗口。
页: [1]
查看完整版本: 求助:threejs+qml+json模型加载失败