Skip to content

Commit

Permalink
chore(deps): update dependency three to v0.166.1 (#4646)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency three to v0.166.1

* chore: fix data texture generation (??) and material onbeforerender

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Håkon Flatval <[email protected]>
  • Loading branch information
renovate[bot] and haakonflatval-cognite authored Jul 17, 2024
1 parent 952801d commit 6569047
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 111 deletions.
4 changes: 2 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/stats.js": "^0.17.0",
"@types/three": "^0.165.0",
"@types/three": "^0.166.0",
"css-loader": "^7.0.0",
"dotenv-webpack": "^8.0.0",
"html-webpack-plugin": "^5.5.0",
"prettier": "^3.0.0",
"three": "0.165.0",
"three": "0.166.1",
"ts-loader": "9.5.1",
"typescript": "^5.0.4",
"webpack": "^5.76.0",
Expand Down
105 changes: 16 additions & 89 deletions examples/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@types/random-seed": "^0.3.5",
"@types/skmeans": "^0.11.7",
"@types/stats": "^0.16.30",
"@types/three": "^0.165.0",
"@types/three": "^0.166.0",
"@types/tween.js": "^18.6.1",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
Expand Down Expand Up @@ -131,7 +131,7 @@
"resize-observer-polyfill": "^1.5.1",
"shx": "^0.3.4",
"stats.js": "^0.17.0",
"three": "0.165.0",
"three": "0.166.1",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"tsc-alias": "^1.8.8",
Expand All @@ -146,7 +146,7 @@
},
"peerDependencies": {
"@cognite/sdk": "^7.16.0 || ^8.0.0",
"three": "0.165.0"
"three": "0.166.1"
},
"glslify": {
"transform": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ export function makeOnBeforeRender(
node: IPointCloudTreeNode,
pcIndex: number
): (renderer: WebGLRenderer, scene: Scene, camera: Camera, bufferGeometry: BufferGeometry, material: Material) => void {
return (_renderer: WebGLRenderer, _scene: Scene, _camera: Camera, _geometry: BufferGeometry, material: Material) => {
return (renderer: WebGLRenderer, _scene: Scene, _camera: Camera, _geometry: BufferGeometry, material: Material) => {
const pointCloudMaterial = material as PointCloudMaterial;
pointCloudMaterial.onBeforeRender(renderer);
const materialUniforms = pointCloudMaterial.uniforms;

materialUniforms.level.value = node.level;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class PointCloudMaterial extends RawShaderMaterial {
glslVersion: GLSL3
});

const tex = (this.visibleNodesTexture = generateDataTexture(2048, 1, COLOR_WHITE));
const tex = (this.visibleNodesTexture = generateDataTexture(2048, 1, COLOR_WHITE, 0x0));
tex.minFilter = NearestFilter;
tex.magFilter = NearestFilter;
this.setUniform('visibleNodes', tex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class PointCloudObjectAppearanceTexture {
private _annotationIdsToObjectId: Map<number, number> | undefined;

constructor(width: number, height: number) {
this._objectStyleTexture = generateDataTexture(width, height, new THREE.Color(0x01000000)); // Initialize with visibility bit set
this._objectStyleTexture = generateDataTexture(width, height, new THREE.Color(0x0), 0x01); // Initialize with visibility bit set

this._width = width;
this._height = height;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from 'three';
import { PointClassification, IGradient } from './types';

export function generateDataTexture(width: number, height: number, color: Color): DataTexture {
export function generateDataTexture(width: number, height: number, color: Color, alpha: number): DataTexture {
const size = width * height;
const data = new Uint8Array(4 * size);

Expand All @@ -26,6 +26,7 @@ export function generateDataTexture(width: number, height: number, color: Color)
data[i * 4] = r;
data[i * 4 + 1] = g;
data[i * 4 + 2] = b;
data[i * 4 + 3] = alpha;
}

const texture = new DataTexture(data, width, height, RGBAFormat);
Expand Down
26 changes: 13 additions & 13 deletions viewer/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6569047

Please sign in to comment.