Not sure if I’m missing something here. But the thinInstanceAdd
and thinInstanceSetBuffer
methods from documentation and code examples do not match the API library
The thinInstanceAdd
method in the documentation (and example) show the refresh
parameter as optional , but Typescript requires this parameter in @babylonjs/core
4.2.0
I believe the source code should be refresh?: boolean
, notice Typescript’s use of ?
to set this parameter as optional.
import { Nullable, DeepImmutableObject } from "../types";
import { Mesh, _InstancesBatch } from "../Meshes/mesh";
import { VertexBuffer, Buffer } from './buffer';
import { Matrix, Vector3, TmpVectors } from '../Maths/math.vector';
declare module "./mesh" {
export interface Mesh {
/**
* Gets or sets a boolean defining if we want picking to pick thin instances as well
*/
thinInstanceEnablePicking: boolean;
/**
* Creates a new thin instance
* @param matrix the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create
* @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance
* @returns the thin instance index number. If you pass an array of matrices, other instance indexes are index+1, index+2, etc
*/
thinInstanceAdd(matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh: boolean): number;
/**
This file has been truncated. show original
There is a similar issue for thinInstanceSetBuffer
You’re right, this should fix it:
BabylonJS:master
← Popov72:fix-thininstance-paramdef
opened 01:18PM - 16 Jan 21 UTC
1 Like
Thanks. thinInstanceSetBuffer
also has parameters which appear to be optional in documentation but required in source.
stride
staticBuffer