Hi guys!
I am trying to get the texture from a render to change its size, but i am stuck in getting the texture point.
According to the documentation, the getSource()
function returns a HTMLImageElement, but i am getting a Uint8Array.
Code sample:
var ChangeTextureSize = pc.createScript('changeTextureSize');
// initialize code called once per entity
ChangeTextureSize.prototype.initialize = function () {
const renders = this.entity.findComponents('render');
renders.forEach(function (render) {
const meshInstances = render.meshInstances;
meshInstances.forEach(async function (meshInstance) {
const diffuseMap = meshInstance.material.diffuseMap;
const img = diffuseMap.getSource();
console.log(img)
});
});
};
Error image:
Any clues in what is happening?