Upgrading from 4.0 to 4.1

This morning I decided to upgrade to 4.1 from 4.0 and now I’m regretting that decision.

I’m seeing lots of errors. The first I’d like to deal with is being able to modify the values in the Matrix.m array. In 4.0 I could do that with no issues. Is there a recommended way to do that in 4.1?

Well this should never happen :frowning: (I mean fighting to move to a new version)

The matrix code has changed to let us flag matrices as dirty. This helped a lot for performance as we do not have to scan a matrix anymore to see if it was updated

So we flagged the matrix.m as deepImutable. If you want to set a specific row you can also call setRow. Also it is still possible to call matrix._m and then call matrix._markAsUpdated();

I’ll try that. Thanks

I’m also seeing a lot of these TS2610 and TS2611 errors. (I’m using Typescript 4.0.2)

src/scripts/libs/BJS_4_1/babylon.d.ts:10729:9 - error TS2610: 'isCube' is defined as an accessor in class 'Texture', but is overridden here in 'ProceduralTexture' as an instance property.

10729         isCube: boolean;
              ~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:15073:13 - error TS2611: 'renderingGroupId' is defined as a property in class 'AbstractMesh', but is overridden here in 'InstancedMesh' as an accessor.

15073         get renderingGroupId(): number;
                  ~~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:20413:9 - error TS2610: 'isCube' is defined as an accessor in class 'Texture', but is overridden here in 'RenderTargetTexture' as an instance property.

20413         isCube: boolean;
              ~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:20460:9 - error TS2610: 'coordinatesMode' is defined as an accessor in class 'Texture', but is overridden here in 'RenderTargetTexture' as an instance property.

20460         coordinatesMode: number;
              ~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:35131:13 - error TS2611: 'environmentTexture' is defined as a property in class 'AbstractScene', but is overridden here in 'Scene' as an accessor.

35131         get environmentTexture(): Nullable<BaseTexture>;
                  ~~~~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:38546:13 - error TS2611: 'upVector' is defined as a property in class 'TargetCamera', but is overridden here in 'ArcRotateCamera' as an accessor.

38546         set upVector(vec: Vector3);
                  ~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:45901:13 - error TS2611: 'updateGizmoRotationToMatchAttachedMesh' is defined as a property in class 'Gizmo', but is overridden here in 'PositionGizmo' as an accessor.

45901         set updateGizmoRotationToMatchAttachedMesh(value: boolean);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:45911:13 - error TS2611: 'scaleRatio' is defined as a property in class 'Gizmo', but is overridden here in 'PositionGizmo' as an accessor.

45911         set scaleRatio(value: number);
                  ~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:47107:13 - error TS2611: 'wrapU' is defined as a property in class 'RenderTargetTexture', but is overridden here in 'MultiRenderTarget' as an accessor.

47107         set wrapU(wrap: number);
                  ~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:47112:13 - error TS2611: 'wrapV' is defined as a property in class 'RenderTargetTexture', but is overridden here in 'MultiRenderTarget' as an accessor.

47112         set wrapV(wrap: number);
                  ~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:48352:13 - error TS2611: 'updateGizmoRotationToMatchAttachedMesh' is defined as a property in class 'Gizmo', but is overridden here in 'ScaleGizmo' as an accessor.

48352         set updateGizmoRotationToMatchAttachedMesh(value: boolean);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:48362:13 - error TS2611: 'scaleRatio' is defined as a property in class 'Gizmo', but is overridden here in 'ScaleGizmo' as an accessor.

48362         set scaleRatio(value: number);
                  ~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:48632:13 - error TS2611: 'updateGizmoRotationToMatchAttachedMesh' is defined as a property in class 'Gizmo', but is overridden here in 'RotationGizmo' as an accessor.

48632         set updateGizmoRotationToMatchAttachedMesh(value: boolean);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:48642:13 - error TS2611: 'scaleRatio' is defined as a property in class 'Gizmo', but is overridden here in 'RotationGizmo' as an accessor.

48642         set scaleRatio(value: number);
                  ~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:54632:9 - error TS2610: 'coordinatesMode' is defined as an accessor in class 'BaseTexture', but is overridden here in 'HDRCubeTexture' as an instance property.

54632         coordinatesMode: number;
              ~~~~~~~~~~~~~~~

src/scripts/libs/BJS_4_1/babylon.d.ts:55860:9 - error TS2610: 'coordinatesMode' is defined as an accessor in class 'BaseTexture', but is overridden here in 'EquiRectangularCubeTexture' as an instance property.

55860         coordinatesMode: number;
              ~~~~~~~~~~~~~~~

Looks like BJS 4.1 isnt compatible with TS4:

So I guess I need to skip BJS 4.1

I recommend 4.2 :smiley:

Almost there. I’m now trying to find all the places where I used Vector3.copyFrom with and OIMO.Vec3. OIMO.Vec3 doesn’t have _x, _y, _z.

Yes again optimization :frowning:

I think I’m good now. It probably wouldve made more sense for me to use a Math library that is separate from OIMO and BJS.

Thanks for your help.

Edit:
Something like this:


Im too far into the project now, though. Maybe next time.

Typescript declarations for Oimojs wouldve helped, too. (this is not on BJS)

Sorry for the inconvenience

Well, I got a little lazy / careless using BJS math functions with oimo vecs.

Thanks for optimizing the engine.

1 Like