three-mesh-bvh
Advanced tools
Comparing version 0.5.3 to 0.5.4
{ | ||
"name": "three-mesh-bvh", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "A BVH implementation to speed up raycasting against three.js meshes.", | ||
@@ -5,0 +5,0 @@ "module": "src/index.js", |
@@ -18,4 +18,2 @@ # three-mesh-bvh | ||
[Clipped edges](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/clippedEdges.html) | ||
[Point cloud interesection](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/pointCloudIntersection.html) | ||
@@ -39,2 +37,4 @@ | ||
[Clipped edges](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/clippedEdges.html) | ||
**Games** | ||
@@ -41,0 +41,0 @@ |
@@ -5,3 +5,3 @@ import { | ||
UnsignedIntType, | ||
RGBFormat, | ||
RGBAFormat, | ||
RGIntegerFormat, | ||
@@ -43,3 +43,3 @@ NearestFilter, | ||
const boundsDimension = 2 * Math.ceil( Math.sqrt( nodeCount / 2 ) ); | ||
const boundsArray = new Float32Array( 3 * boundsDimension * boundsDimension ); | ||
const boundsArray = new Float32Array( 4 * boundsDimension * boundsDimension ); | ||
@@ -54,5 +54,6 @@ const contentsDimension = Math.ceil( Math.sqrt( nodeCount ) ); | ||
const boundsIndex = BOUNDING_DATA_INDEX( nodeIndex32 ); | ||
for ( let b = 0; b < 6; b ++ ) { | ||
for ( let b = 0; b < 3; b ++ ) { | ||
boundsArray[ 6 * i + b ] = float32Array[ boundsIndex + b ]; | ||
boundsArray[ 8 * i + 0 + b ] = float32Array[ boundsIndex + 0 + b ]; | ||
boundsArray[ 8 * i + 4 + b ] = float32Array[ boundsIndex + 3 + b ]; | ||
@@ -85,5 +86,5 @@ } | ||
boundsTexture.image.height = boundsDimension; | ||
boundsTexture.format = RGBFormat; | ||
boundsTexture.format = RGBAFormat; | ||
boundsTexture.type = FloatType; | ||
boundsTexture.internalFormat = 'RGB32F'; | ||
boundsTexture.internalFormat = 'RGBA32F'; | ||
boundsTexture.minFilter = NearestFilter; | ||
@@ -90,0 +91,0 @@ boundsTexture.magFilter = NearestFilter; |
@@ -13,3 +13,2 @@ import { | ||
RGFormat, | ||
RGBFormat, | ||
RGBAFormat, | ||
@@ -19,3 +18,2 @@ | ||
RGIntegerFormat, | ||
RGBIntegerFormat, | ||
RGBAIntegerFormat, | ||
@@ -32,3 +30,3 @@ | ||
case 2: return 'RG'; | ||
case 3: return 'RGB'; | ||
case 3: return 'RGBA'; | ||
case 4: return 'RGBA'; | ||
@@ -48,3 +46,3 @@ | ||
case 2: return RGFormat; | ||
case 3: return RGBFormat; | ||
case 3: return RGBAFormat; | ||
case 4: return RGBAFormat; | ||
@@ -62,3 +60,3 @@ | ||
case 2: return RGIntegerFormat; | ||
case 3: return RGBIntegerFormat; | ||
case 3: return RGBAIntegerFormat; | ||
case 4: return RGBAIntegerFormat; | ||
@@ -107,2 +105,3 @@ | ||
let targetType = this._forcedType; | ||
let finalStride = itemSize; | ||
@@ -219,9 +218,17 @@ // derive the type of texture this should be in the shader | ||
// there will be a mismatch between format length and final length because | ||
// RGBFormat and RGBIntegerFormat was removed | ||
if ( finalStride === 3 && ( format === RGBAFormat || format === RGBAIntegerFormat ) ) { | ||
finalStride = 4; | ||
} | ||
// copy the data over to the new texture array | ||
const dimension = Math.ceil( Math.sqrt( count ) ); | ||
const length = itemSize * dimension * dimension; | ||
const length = finalStride * dimension * dimension; | ||
const dataArray = new targetBufferCons( length ); | ||
for ( let i = 0; i < count; i ++ ) { | ||
const ii = itemSize * i; | ||
const ii = finalStride * i; | ||
dataArray[ ii ] = attr.getX( i ) / normalizeValue; | ||
@@ -239,2 +246,8 @@ | ||
if ( finalStride === 4 ) { | ||
dataArray[ ii + 3 ] = 1.0; | ||
} | ||
} | ||
@@ -241,0 +254,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1060225
11454