Vertex texture fetch support

Hello,

In my project I was using @types/cesium and everything was working fine.

Today, I decided to move to built in type of cesium, so instead of doing

Cesium.Blabla()

I am doing

import {Blabla} from 'cesium'
Blabla()

Now, this technically should break anything, but it broke some stuff…

I am trying to fix those issue, and I have the following problem now.

The following code

    const rectangleInstance = new GeometryInstance({
      geometry: new PolygonGeometry({
        polygonHierarchy: new PolygonHierarchy(AreaUtils.getAreaCoordinates(area)),
      }),
      id: area.id.toString(),
      attributes: {
        color: new ColorGeometryInstanceAttribute(0, 0, 1.0, 0.2),
      },
    });
    const newArea = new GroundPrimitive({
      geometryInstances: rectangleInstance,
      show: this.show,
    });
    this.viewer.scene.primitives.add(newArea);

break the viewer with the following error

Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.

In the library the error is due to

  if (this._batchTable.attributes.length > 0) {
    if (_Renderer_ContextLimits_js__WEBPACK_IMPORTED_MODULE_26__["default"].maximumVertexTextureImageUnits === 0) {
      throw new _Core_RuntimeError_js__WEBPACK_IMPORTED_MODULE_22__["default"]("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");
    }

    this._batchTable.update(frameState);
  }

But I have strictly no idea how to fix this.

I tried to remove

      attributes: {
        color: new ColorGeometryInstanceAttribute(0, 0, 1.0, 0.2),
      },

but it now tell me that

TypeError: Cannot read property ‘material’ of undefined

EDIT : If I use the GLOBAL object instead of the import, it works again :

    const t = window.Cesium;
    const rectangleInstance = new t.GeometryInstance({
      geometry: new t.PolygonGeometry({
        polygonHierarchy: new t.PolygonHierarchy(AreaUtils.getAreaCoordinates(area)),
      }),
      id: area.id.toString(),
      attributes: {
        color: new t.ColorGeometryInstanceAttribute(0, 0, 1.0, 0.2),
      },
    });
    const newArea = new t.GroundPrimitive({
      geometryInstances: rectangleInstance,
      show: this.show,
    });
    this.viewer.scene.primitives.add(newArea);
    this.areaMap.set(area.id, newArea);

No error here.

I’m having the same issue - did you manage to resolve this?