state of WallGeometry in the master branch

Hi,

I'm trying to use the WallGeometry object, which I contributed earlier
to the batching branch. I was told that batching has been merged to
master, so I'm now trying to use WallGeometry in the master branch. but,
it seems to make Cesium hang :frowning:

what I'm trying is either simply:

     var positions = [
       Cesium.Cartographic.fromDegrees(19.0, 47.0, 10000.0),
       Cesium.Cartographic.fromDegrees(19.0, 48.0, 10000.0),
       Cesium.Cartographic.fromDegrees(20.0, 48.0, 10000.0),
       Cesium.Cartographic.fromDegrees(20.0, 47.0, 10000.0),
       Cesium.Cartographic.fromDegrees(19.0, 47.0, 10000.0)
     ];

     // create a wall that spans from ground level to 10000 meters
     var wall = new Cesium.WallGeometry({
         positions :
Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions)
     });

    viewer.scene.getPrimitives().add(wall);

or with a primitive:

        var material = Cesium.Material.fromType(options.context, 'Color');
        material.uniforms.color = new Cesium.Color(1, 1, 0, 0.4);
        var appearance = new Cesium.MaterialAppearance({
            renderState : {
                cull : {
                    enabled : false
                },
                depthTest : {
                    enabled : true
                },
                depthMask : false,
                blending : Cesium.BlendingState.ALPHA_BLEND
            },
            faceForward : true,
            translucent : true,
            material : material
        });
           
            var primitive = new Cesium.Primitive({
                geometryInstances : wall,
                appearance : appearance
            });

    viewer.scene.getPrimitives().add(primitive);

in both cases, Cesium will hang on the getPrimitives().add() call

what am I doing wrong?

Akos

Hello Akos,

the Primitive parameter ‘geometryInstances’ expects a GeometryInstance object (or array of GeometryInstance objects)

Here’s an example:

// Create a single wall

var wallInstance = new Cesium.GeometryInstance({

geometry : new Cesium.WallGeometry({

positions : ellipsoid.cartographicArrayToCartesianArray([

Cesium.Cartographic.fromDegrees(-100.0, 42.0, 100000.0),

Cesium.Cartographic.fromDegrees(-95.0, 42.0, 100000.0),

Cesium.Cartographic.fromDegrees(-95.0, 45.0, 100000.0),

Cesium.Cartographic.fromDegrees(-100.0, 45.0, 100000.0),

Cesium.Cartographic.fromDegrees(-100.0, 42.0, 100000.0)

])

})

});

var wallMaterial = Cesium.Material.fromType(scene.getContext(), ‘Checkerboard’);

var wallPrimitive = new Cesium.Primitive({

geometryInstances : wallInstance,

appearance : new Cesium.MaterialAppearance({

material : wallMaterial,

faceForward : true

})

});

wallMaterial.uniforms.repeat = new Cesium.Cartesian2(20.0, 6.0);

viewer.scene.getPrimitives().add(wallPrimitive);

-Hannah

Hannah,

the Primitive parameter 'geometryInstances' expects a GeometryInstance
object (or array of GeometryInstance objects)

Here's an example:

    // Create a single wall
    var wallInstance = new Cesium.GeometryInstance({
        geometry : new Cesium.WallGeometry({
            positions : ellipsoid.cartographicArrayToCartesianArray([
                Cesium.Cartographic.fromDegrees(-100.0, 42.0, 100000.0),
                Cesium.Cartographic.fromDegrees(-95.0, 42.0, 100000.0),
                Cesium.Cartographic.fromDegrees(-95.0, 45.0, 100000.0),
                Cesium.Cartographic.fromDegrees(-100.0, 45.0, 100000.0),
                Cesium.Cartographic.fromDegrees(-100.0, 42.0, 100000.0)
            ])
        })
    });
    var wallMaterial = Cesium.Material.fromType(scene.getContext(),
'Checkerboard');
    var wallPrimitive = new Cesium.Primitive({
        geometryInstances : wallInstance,
        appearance : new Cesium.MaterialAppearance({
            material : wallMaterial,
            faceForward : true
        })
    });
    wallMaterial.uniforms.repeat = new Cesium.Cartesian2(20.0, 6.0);
    viewer.scene.getPrimitives().add(wallPrimitive);

thanks, indeed. I'm sorry for not following up on the API change properly.

now, I seem to have found an issue with WallGeometry. if the wall
position array contains the same point multiple times, Cesium will hang
after adding the primitive containing this wall.

this seems to be only true if the same points follow each other. but it
seems similarity only matters in terms of coordinates - so, if two
consecutive points have the same coordinates, but different height,
Cesium will still hang :frowning:

should I file a bug report with this issue?

Akos

should I file a bug report with this issue?

Yes please.

Also, to stay up with all the changes to the geometries, here is a draft tutorial: https://github.com/AnalyticalGraphicsInc/cesium/wiki/Geometry-and-Appearances

Patrick

ok, here you go:
thanks!

That behavior sounds somewhat similar to this issue I’ve seen on Linux:

https://groups.google.com/forum/#!topic/cesium-dev/WrrR7fFFvVo

I updated the related issue, #898.

Patrick