Skip to content

Commit

Permalink
Merge pull request #13744 from RaananW/fixInstancedMeshMissingSetters
Browse files Browse the repository at this point in the history
Adding no-op setters to instancedMesh
  • Loading branch information
sebavan committed Apr 17, 2023
2 parents 649b7a0 + 827e37f commit 32d6f52
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/dev/core/src/Meshes/instancedMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { DeepCopier } from "../Misc/deepCopier";
import { TransformNode } from "./transformNode";
import type { Light } from "../Lights/light";
import { VertexBuffer } from "../Buffers/buffer";
import { Tools } from "../Misc/tools";

Mesh._instancedMeshFactory = (name: string, mesh: Mesh): InstancedMesh => {
const instance = new InstancedMesh(name, mesh);
Expand Down Expand Up @@ -42,6 +43,11 @@ export class InstancedMesh extends AbstractMesh {
/** @internal */
public _previousWorldMatrix: Nullable<Matrix>;

/**
* Creates a new InstancedMesh object from the mesh source.
* @param name defines the name of the instance
* @param source the mesh to create the instance from
*/
constructor(name: string, source: Mesh) {
super(name, source.getScene());

Expand Down Expand Up @@ -106,27 +112,51 @@ export class InstancedMesh extends AbstractMesh {
return this._sourceMesh.receiveShadows;
}

public set receiveShadows(_value: boolean) {
if (this._sourceMesh?.receiveShadows !== _value) {
Tools.Warn("Setting receiveShadows on an instanced mesh has no effect");
}
}

/**
* The material of the source mesh
*/
public get material(): Nullable<Material> {
return this._sourceMesh.material;
}

public set material(_value: Nullable<Material>) {
if (this._sourceMesh?.material !== _value) {
Tools.Warn("Setting material on an instanced mesh has no effect");
}
}

/**
* Visibility of the source mesh
*/
public get visibility(): number {
return this._sourceMesh.visibility;
}

public set visibility(_value: number) {
if (this._sourceMesh?.visibility !== _value) {
Tools.Warn("Setting visibility on an instanced mesh has no effect");
}
}

/**
* Skeleton of the source mesh
*/
public get skeleton(): Nullable<Skeleton> {
return this._sourceMesh.skeleton;
}

public set skeleton(_value: Nullable<Skeleton>) {
if (this._sourceMesh?.skeleton !== _value) {
Tools.Warn("Setting skeleton on an instanced mesh has no effect");
}
}

/**
* Rendering ground id of the source mesh
*/
Expand Down

0 comments on commit 32d6f52

Please sign in to comment.