@galacean/engine 1.1.0-beta.46 → 1.1.0-beta.49

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 CHANGED
@@ -19257,7 +19257,9 @@
19257
19257
  };
19258
19258
  if (hitResult != undefined) {
19259
19259
  var result = this._nativePhysicsScene.raycast(ray, distance, onRaycast, function(idx, distance, position, normal) {
19260
- hitResult.entity = _this._scene.engine._physicalObjectsMap[idx]._collider.entity;
19260
+ var hitShape = _this._scene.engine._physicalObjectsMap[idx];
19261
+ hitResult.entity = hitShape._collider.entity;
19262
+ hitResult.shape = hitShape;
19261
19263
  hitResult.distance = distance;
19262
19264
  hitResult.normal.copyFrom(normal);
19263
19265
  hitResult.point.copyFrom(position);
@@ -19266,6 +19268,7 @@
19266
19268
  return true;
19267
19269
  } else {
19268
19270
  hitResult.entity = null;
19271
+ hitResult.shape = null;
19269
19272
  hitResult.distance = 0;
19270
19273
  hitResult.point.set(0, 0, 0);
19271
19274
  hitResult.normal.set(0, 0, 0);
@@ -19923,6 +19926,7 @@
19923
19926
  /** The distance from the ray's origin to the impact point. */ this.distance = 0;
19924
19927
  /** The impact point in world space where the ray hit the collider. */ this.point = new Vector3();
19925
19928
  /** The normal of the surface the ray hit. */ this.normal = new Vector3();
19929
+ /** The shape of the collider that was hit. */ this.shape = null;
19926
19930
  };
19927
19931
  /**
19928
19932
  * Describes how physics materials of the colliding objects are combined.
@@ -26713,7 +26717,7 @@
26713
26717
  }
26714
26718
  // make suer from the same renderer.
26715
26719
  if (componentA.instanceId === componentB.instanceId) {
26716
- return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
26720
+ return dataA.material._priority - dataB.material._priority;
26717
26721
  } else {
26718
26722
  var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
26719
26723
  if (distanceDiff === 0) {
@@ -26736,7 +26740,7 @@
26736
26740
  }
26737
26741
  // make suer from the same renderer.
26738
26742
  if (componentA.instanceId === componentB.instanceId) {
26739
- return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
26743
+ return dataA.material._priority - dataB.material._priority;
26740
26744
  } else {
26741
26745
  var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
26742
26746
  if (distanceDiff === 0) {
@@ -36028,7 +36032,7 @@
36028
36032
  var cap = this.capabilityList;
36029
36033
  var isWebGL2 = this.rhi.isWebGL2;
36030
36034
  var requireExtension = this.rhi.requireExtension.bind(this.rhi);
36031
- var shaderVertexID = exports.GLCapabilityType.shaderVertexID, standardDerivatives = exports.GLCapabilityType.standardDerivatives, shaderTextureLod = exports.GLCapabilityType.shaderTextureLod, elementIndexUint = exports.GLCapabilityType.elementIndexUint, depthTexture = exports.GLCapabilityType.depthTexture, vertexArrayObject = exports.GLCapabilityType.vertexArrayObject, instancedArrays = exports.GLCapabilityType.instancedArrays, multipleSample = exports.GLCapabilityType.multipleSample, drawBuffers = exports.GLCapabilityType.drawBuffers, astc = exports.GLCapabilityType.astc, astc_webkit = exports.GLCapabilityType.astc_webkit, etc = exports.GLCapabilityType.etc, etc_webkit = exports.GLCapabilityType.etc_webkit, etc1 = exports.GLCapabilityType.etc1, etc1_webkit = exports.GLCapabilityType.etc1_webkit, pvrtc = exports.GLCapabilityType.pvrtc, pvrtc_webkit = exports.GLCapabilityType.pvrtc_webkit, s3tc = exports.GLCapabilityType.s3tc, s3tc_webkit = exports.GLCapabilityType.s3tc_webkit, bptc = exports.GLCapabilityType.bptc, textureFloat = exports.GLCapabilityType.textureFloat, textureHalfFloat = exports.GLCapabilityType.textureHalfFloat, textureFloatLinear = exports.GLCapabilityType.textureFloatLinear, textureHalfFloatLinear = exports.GLCapabilityType.textureHalfFloatLinear, WEBGL_colorBufferFloat = exports.GLCapabilityType.WEBGL_colorBufferFloat, colorBufferFloat = exports.GLCapabilityType.colorBufferFloat, colorBufferHalfFloat = exports.GLCapabilityType.colorBufferHalfFloat, textureFilterAnisotropic = exports.GLCapabilityType.textureFilterAnisotropic;
36035
+ var shaderVertexID = exports.GLCapabilityType.shaderVertexID, standardDerivatives = exports.GLCapabilityType.standardDerivatives, shaderTextureLod = exports.GLCapabilityType.shaderTextureLod, elementIndexUint = exports.GLCapabilityType.elementIndexUint, depthTexture = exports.GLCapabilityType.depthTexture, vertexArrayObject = exports.GLCapabilityType.vertexArrayObject, instancedArrays = exports.GLCapabilityType.instancedArrays, multipleSample = exports.GLCapabilityType.multipleSample, drawBuffers = exports.GLCapabilityType.drawBuffers, blendMinMax = exports.GLCapabilityType.blendMinMax, astc = exports.GLCapabilityType.astc, astc_webkit = exports.GLCapabilityType.astc_webkit, etc = exports.GLCapabilityType.etc, etc_webkit = exports.GLCapabilityType.etc_webkit, etc1 = exports.GLCapabilityType.etc1, etc1_webkit = exports.GLCapabilityType.etc1_webkit, pvrtc = exports.GLCapabilityType.pvrtc, pvrtc_webkit = exports.GLCapabilityType.pvrtc_webkit, s3tc = exports.GLCapabilityType.s3tc, s3tc_webkit = exports.GLCapabilityType.s3tc_webkit, bptc = exports.GLCapabilityType.bptc, textureFloat = exports.GLCapabilityType.textureFloat, textureHalfFloat = exports.GLCapabilityType.textureHalfFloat, textureFloatLinear = exports.GLCapabilityType.textureFloatLinear, textureHalfFloatLinear = exports.GLCapabilityType.textureHalfFloatLinear, WEBGL_colorBufferFloat = exports.GLCapabilityType.WEBGL_colorBufferFloat, colorBufferFloat = exports.GLCapabilityType.colorBufferFloat, colorBufferHalfFloat = exports.GLCapabilityType.colorBufferHalfFloat, textureFilterAnisotropic = exports.GLCapabilityType.textureFilterAnisotropic;
36032
36036
  cap.set(shaderVertexID, isWebGL2);
36033
36037
  cap.set(standardDerivatives, isWebGL2 || !!requireExtension(standardDerivatives));
36034
36038
  cap.set(shaderTextureLod, isWebGL2 || !!requireExtension(shaderTextureLod));
@@ -36038,6 +36042,7 @@
36038
36042
  cap.set(instancedArrays, isWebGL2 || !!requireExtension(instancedArrays));
36039
36043
  cap.set(multipleSample, isWebGL2);
36040
36044
  cap.set(drawBuffers, isWebGL2 || !!requireExtension(drawBuffers));
36045
+ cap.set(blendMinMax, isWebGL2 || !!requireExtension(blendMinMax));
36041
36046
  cap.set(textureFloat, isWebGL2 || !!requireExtension(textureFloat));
36042
36047
  cap.set(textureHalfFloat, isWebGL2 || !!requireExtension(textureHalfFloat));
36043
36048
  cap.set(textureFloatLinear, !!requireExtension(textureFloatLinear));
@@ -36078,9 +36083,13 @@
36078
36083
  }
36079
36084
  };
36080
36085
  _proto._compatibleAllInterface = function _compatibleAllInterface() {
36081
- var depthTexture = exports.GLCapabilityType.depthTexture, vertexArrayObject = exports.GLCapabilityType.vertexArrayObject, instancedArrays = exports.GLCapabilityType.instancedArrays, drawBuffers = exports.GLCapabilityType.drawBuffers, textureFilterAnisotropic = exports.GLCapabilityType.textureFilterAnisotropic, textureHalfFloat = exports.GLCapabilityType.textureHalfFloat, colorBufferHalfFloat = exports.GLCapabilityType.colorBufferHalfFloat, WEBGL_colorBufferFloat = exports.GLCapabilityType.WEBGL_colorBufferFloat;
36086
+ var depthTexture = exports.GLCapabilityType.depthTexture, vertexArrayObject = exports.GLCapabilityType.vertexArrayObject, instancedArrays = exports.GLCapabilityType.instancedArrays, drawBuffers = exports.GLCapabilityType.drawBuffers, textureFilterAnisotropic = exports.GLCapabilityType.textureFilterAnisotropic, textureHalfFloat = exports.GLCapabilityType.textureHalfFloat, colorBufferHalfFloat = exports.GLCapabilityType.colorBufferHalfFloat, WEBGL_colorBufferFloat = exports.GLCapabilityType.WEBGL_colorBufferFloat, blendMinMax = exports.GLCapabilityType.blendMinMax;
36082
36087
  var isWebGL2 = this.rhi.isWebGL2;
36083
36088
  if (!isWebGL2) {
36089
+ this._compatibleInterface(blendMinMax, {
36090
+ MIN: "MIN_EXT",
36091
+ MAX: "MAX_EXT"
36092
+ });
36084
36093
  this._compatibleInterface(depthTexture, {
36085
36094
  UNSIGNED_INT_24_8: "UNSIGNED_INT_24_8_WEBGL"
36086
36095
  });
@@ -40003,7 +40012,7 @@
40003
40012
  };
40004
40013
  /**
40005
40014
  * Parse the glb format.
40006
- */ GLTFUtils.parseGLB = function parseGLB(context, glb) {
40015
+ */ GLTFUtils.parseGLB = function parseGLB(context, originBuffer) {
40007
40016
  var UINT32_LENGTH = 4;
40008
40017
  var GLB_HEADER_MAGIC = 0x46546c67; // 'glTF'
40009
40018
  var GLB_HEADER_LENGTH = 12;
@@ -40011,7 +40020,7 @@
40011
40020
  JSON: 0x4e4f534a,
40012
40021
  BIN: 0x004e4942
40013
40022
  };
40014
- var dataView = new DataView(glb);
40023
+ var dataView = new DataView(originBuffer);
40015
40024
  // read header
40016
40025
  var header = {
40017
40026
  magic: dataView.getUint32(0, true),
@@ -40019,8 +40028,9 @@
40019
40028
  length: dataView.getUint32(2 * UINT32_LENGTH, true)
40020
40029
  };
40021
40030
  if (header.magic !== GLB_HEADER_MAGIC) {
40022
- console.error("Invalid glb magic number. Expected 0x46546C67, found 0x" + header.magic.toString(16));
40023
- return null;
40031
+ return {
40032
+ originBuffer: originBuffer
40033
+ };
40024
40034
  }
40025
40035
  // read main data
40026
40036
  var chunkLength = dataView.getUint32(GLB_HEADER_LENGTH, true);
@@ -40030,7 +40040,7 @@
40030
40040
  console.error("Invalid glb chunk type. Expected 0x4E4F534A, found 0x" + chunkType.toString(16));
40031
40041
  return null;
40032
40042
  }
40033
- var glTFData = new Uint8Array(glb, GLB_HEADER_LENGTH + 2 * UINT32_LENGTH, chunkLength);
40043
+ var glTFData = new Uint8Array(originBuffer, GLB_HEADER_LENGTH + 2 * UINT32_LENGTH, chunkLength);
40034
40044
  var glTF = JSON.parse(Utils.decodeText(glTFData));
40035
40045
  // read all buffers
40036
40046
  var buffers = [];
@@ -40044,7 +40054,7 @@
40044
40054
  return null;
40045
40055
  }
40046
40056
  var currentOffset = byteOffset + 2 * UINT32_LENGTH;
40047
- var buffer = glb.slice(currentOffset, currentOffset + chunkLength);
40057
+ var buffer = originBuffer.slice(currentOffset, currentOffset + chunkLength);
40048
40058
  buffers.push(buffer);
40049
40059
  restoreGLBBufferSlice.push(new Vector2(currentOffset, chunkLength));
40050
40060
  byteOffset += chunkLength + 2 * UINT32_LENGTH;
@@ -41440,23 +41450,20 @@
41440
41450
  var requestConfig = {
41441
41451
  type: "arraybuffer"
41442
41452
  };
41443
- var isGLB = this._isGLB(url);
41444
- contentRestorer.isGLB = isGLB;
41445
- var promise = isGLB ? request(url, requestConfig).then(function(glb) {
41453
+ return request(url, requestConfig).then(function(buffer) {
41446
41454
  restoreBufferRequests.push(new BufferRequestInfo(url, requestConfig));
41447
- return GLTFUtils.parseGLB(context, glb);
41448
- }).then(function(param) {
41449
- var glTF = param.glTF, buffers = param.buffers;
41450
- context.buffers = buffers;
41451
- return glTF;
41452
- }) : request(url, {
41453
- type: "json"
41455
+ return GLTFUtils.parseGLB(context, buffer);
41456
+ }).then(function(result) {
41457
+ var _result;
41458
+ if ((_result = result) == null ? void 0 : _result.glTF) {
41459
+ contentRestorer.isGLB = true;
41460
+ context.buffers = result.buffers;
41461
+ return result.glTF;
41462
+ } else {
41463
+ contentRestorer.isGLB = false;
41464
+ return JSON.parse(Utils.decodeText(new Uint8Array(result.originBuffer)));
41465
+ }
41454
41466
  });
41455
- return promise;
41456
- };
41457
- _proto._isGLB = function _isGLB(url) {
41458
- var index = url.lastIndexOf(".");
41459
- return url.substring(index + 1, index + 4) === "glb";
41460
41467
  };
41461
41468
  return GLTFSchemaParser;
41462
41469
  }(GLTFParser);
@@ -44090,7 +44097,7 @@
44090
44097
  ], GALACEAN_animation_event);
44091
44098
 
44092
44099
  //@ts-ignore
44093
- var version = "1.1.0-beta.46";
44100
+ var version = "1.1.0-beta.49";
44094
44101
  console.log("Galacean engine version: " + version);
44095
44102
  for(var key in CoreObjects){
44096
44103
  Loader.registerClass(key, CoreObjects[key]);