Skip to content

Commit

Permalink
[ts][threejs] Run tsfmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidetan committed Nov 26, 2024
1 parent d14f485 commit 10ae451
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions spine-ts/spine-threejs/src/MeshBatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export class MeshBatcher extends THREE.Mesh {
private materialGroups: [number, number, number][] = [];

constructor (
maxVertices: number = MeshBatcher.MAX_VERTICES,
private materialFactory: (parameters: THREE.MaterialParameters) => MaterialWithMap,
private twoColorTint = true,
) {
maxVertices: number = MeshBatcher.MAX_VERTICES,
private materialFactory: (parameters: THREE.MaterialParameters) => MaterialWithMap,
private twoColorTint = true,
) {
super();

if (maxVertices > MeshBatcher.MAX_VERTICES) throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
Expand Down Expand Up @@ -237,7 +237,7 @@ export class MeshBatcher extends THREE.Mesh {
return group;
}

private newMaterial(): MaterialWithMap {
private newMaterial (): MaterialWithMap {
const meshMaterial = this.materialFactory(SkeletonMesh.DEFAULT_MATERIAL_PARAMETERS);

if (!('map' in meshMaterial)) {
Expand Down Expand Up @@ -328,7 +328,7 @@ const spineOnBeforeCompile = (shader: THREE.WebGLProgramParametersWithUniforms)

}

function insertAfterElementInShader(shader: string, elementToFind: string, codeToInsert: string) {
function insertAfterElementInShader (shader: string, elementToFind: string, codeToInsert: string) {
const index = shader.indexOf(elementToFind);
const beforeToken = shader.slice(0, index + elementToFind.length);
const afterToken = shader.slice(index + elementToFind.length);
Expand All @@ -344,11 +344,11 @@ function updateMeshMaterial (meshMaterial: MaterialWithMap, slotTexture: THREE.T

export class SkeletonMeshMaterial extends THREE.ShaderMaterial {

public get map(): THREE.Texture | null {
public get map (): THREE.Texture | null {
return this.uniforms.map.value;
}

public set map(value: THREE.Texture | null) {
public set map (value: THREE.Texture | null) {
this.uniforms.map.value = value;
}

Expand Down
34 changes: 17 additions & 17 deletions spine-ts/spine-threejs/src/SkeletonMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,29 @@ export class SkeletonMesh extends THREE.Object3D {
this.state = new AnimationState(animData);

Object.defineProperty(this, 'castShadow', {
get: () => this._castShadow,
set: (value: boolean) => {
this._castShadow = value;
this.traverse((child) => {
get: () => this._castShadow,
set: (value: boolean) => {
this._castShadow = value;
this.traverse((child) => {
if (child instanceof MeshBatcher) {
child.castShadow = value;
child.castShadow = value;
}
});
},
});
});
},
});

Object.defineProperty(this, 'receiveShadow', {
get: () => this._receiveShadow,
set: (value: boolean) => {
this._receiveShadow = value;
// Propagate to children
this.traverse((child) => {
get: () => this._receiveShadow,
set: (value: boolean) => {
this._receiveShadow = value;
// Propagate to children
this.traverse((child) => {
if (child instanceof MeshBatcher) {
child.receiveShadow = value;
child.receiveShadow = value;
}
});
},
});
});
},
});
}

update (deltaTime: number) {
Expand Down

0 comments on commit 10ae451

Please sign in to comment.