diff --git a/examples/jsm/loaders/KTX2Loader.js b/examples/jsm/loaders/KTX2Loader.js index 75e717c100d0d8..6032c6bdda1992 100644 --- a/examples/jsm/loaders/KTX2Loader.js +++ b/examples/jsm/loaders/KTX2Loader.js @@ -971,6 +971,8 @@ KTX2Loader.BasisWorker = function () { const UNCOMPRESSED_FORMATS = new Set( [ RGBAFormat, RGBFormat, RGFormat, RedFormat ] ); +const NORMALIZED_VK_FORMATS = new Set( [ VK_FORMAT_R16G16B16A16_UNORM ] ); + const FORMAT_MAP = { [ VK_FORMAT_R32G32B32A32_SFLOAT ]: RGBAFormat, @@ -1220,6 +1222,7 @@ async function createRawTexture( container ) { texture.minFilter = useMipmaps ? NearestMipmapNearestFilter : NearestFilter; texture.magFilter = NearestFilter; texture.generateMipmaps = container.levelCount === 0; + texture.normalized = NORMALIZED_VK_FORMATS.has( vkFormat ); } else { diff --git a/src/geometries/SphereGeometry.js b/src/geometries/SphereGeometry.js index 3fa34b879f7c1e..a0eeed5a540a75 100644 --- a/src/geometries/SphereGeometry.js +++ b/src/geometries/SphereGeometry.js @@ -76,6 +76,10 @@ class SphereGeometry extends BufferGeometry { const verticesRow = []; const v = iy / heightSegments; + const theta = thetaStart + v * thetaLength; + + const y = radius * Math.cos( theta ); + const ringRadius = Math.sqrt( radius * radius - y * y ); // special case for the poles @@ -94,12 +98,13 @@ class SphereGeometry extends BufferGeometry { for ( let ix = 0; ix <= widthSegments; ix ++ ) { const u = ix / widthSegments; + const phi = phiStart + u * phiLength; // vertex - vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - vertex.y = radius * Math.cos( thetaStart + v * thetaLength ); - vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); + vertex.x = - ringRadius * Math.cos( phi ); + vertex.y = y; + vertex.z = ringRadius * Math.sin( phi ); vertices.push( vertex.x, vertex.y, vertex.z );