function create() {
createPrimitive(‘1’,
-15.5, -15.5, 15.5, 15.5, ‘Images/Koala.jpg’);
//-15, -15, 15, 15, 'Images/Koala.jpg');**If the argument is a decimal, the two pictures that are created will cross, as shown in the attachment.and ****scene.primitives.lowerToBottom 、****raiseToTop。doesn't work。****If the argument is an integer, the picture appears normal.**
createPrimitive(‘2’,
-20, -20, 30, 30, ‘Images/Lighthouse.jpg’);
}
//创建Primitive
var createPrimitive = function (id, west, south, east, north, imagepath) {
let instance = new Cesium.GeometryInstance({
id: id,
geometry: new Cesium.RectangleGeometry({
rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north)
}),
});
var myPrimitive = new Cesium.Primitive({
geometryInstances: instance,
appearance: new Cesium.MaterialAppearance({
material: new Cesium.Material({
fabric: {
type: ‘Image’,
uniforms: {
image: imagepath
}
}
})
})
});
scene.primitives.add(myPrimitive);
}
``
two bug
**1:****If the argument( ****new Cesium.Rectangle(west, south, east, north) ) ****is a decimal, the two pictures that are created will cross, and ****scene.primitives.lowerToBottom 、****raiseToTop…doesn’t work。**If the argument is an integer, the picture appears normal.
**2:****If you manipulate the two-rectangle matrix, the rectangle rotates to the other latitude and longitude of the ball, can cause two of pictures to cross display,****and **scene.primitives.lowerToBottom 、raiseToTop…doesn’t work。For example:
var calRotateMatrix = function(lon, lat) {
var modelMatrix;
if (scene.mode == 3) {
let rotatez = Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(lon));
let rotatex = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(0 - lat));
modelMatrix = Cesium.Matrix4.IDENTITY;
modelMatrix = Cesium.Matrix4.multiplyByMatrix3(modelMatrix, rotatez, new Cesium.Cartesian4());
modelMatrix = Cesium.Matrix4.multiplyByMatrix3(modelMatrix, rotatex, new Cesium.Cartesian4());
}
return modelMatrix;
}
function create() {
var modelMatrix1 =calRotateMatrix (50,80);
var modelMatrix2 =calRotateMatrix (50,70);
createPrimitive('1',-15, -15, 15, 15, 'Images/Koala.jpg',modelMatrix1);
createPrimitive(‘2’,-20, -20, 30, 30, ‘Images/Lighthouse.jpg’,modelMatrix2);
}
//创建Primitive
var createPrimitive = function (id, west, south, east, north, imagepath,modelMatrix) {
let instance = new Cesium.GeometryInstance({
id: id,
geometry: new Cesium.RectangleGeometry({
rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north)
}),
});
var myPrimitive = new Cesium.Primitive({
geometryInstances: instance,
appearance: new Cesium.MaterialAppearance({
material: new Cesium.Material({
fabric: {
type: ‘Image’,
uniforms: {
image: imagepath
}
}
})
}),
**modelMatrix: modelMatrix**
});
scene.primitives.add(myPrimitive);
}
``