Pawn is a small object which can be inserted into the scene. It can be out of another model or created dynamically.
Signature:
addPawn(pawn: Pawn, changeCamera?: boolean, batch?: boolean): void;
Parameter | Description |
---|---|
pawn | The pawn object. |
changeCamera | |
batch |
Returns:
void
// Create ground geometry
var ground = new Modelo.Scene3D.Pawn("ground", viewer.getResourceManager(), viewer.getMaterialManager());
ground.createSolidCube();
ground.setScaling(40, 40, 1.0);
viewer.getScene().addPawn(ground);
var image1 = new Image();
image1.src = "/chessboard.jpg";
image1.onload = function() {
var groundPlane = new Modelo.Scene3D.Pawn("ground1", viewer.getResourceManager(), viewer.getMaterialManager());
groundPlane.createTexturedQuad([image1]);
groundPlane.setScaling(40, 40, 1.0);
groundPlane.setTranslation(0, 0, 1.01);
viewer.getScene().addPawn(groundPlane);
};
var smallModel = new Modelo.Scene3D.Pawn("model", viewer.getResourceManager(), viewer.getMaterialManager());
smallModel.load(modelId2)
.then(() => {
viewer.getScene().addPawn(smallModel);
});