Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {

Expand Down
11 changes: 8 additions & 3 deletions src/geometries/SphereGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 );

Expand Down