class HmPintura extends HmAncestralObject3d {
constructor (_quadro) {
super({quadro: _quadro});
}
preparar() {
super.preparar();
/*
this.object3d.acaoInterceptacao() {
};
*/
var c = this.quadro.cfg;
this.cfg = c;
this.codigo = c.quadro.toUpperCase();
this.autor = c.autor;
this.largura = c.largura;
this.altura = c.altura;
this.meiaLargura = this.largura / 2;
this.meiaAltura = this.altura / 2;
this.ext = c.ext;
}
/*
criar() {
super.criar();
//this.criarPintura();
//this.criarTexturaPintura(this.cfg.resolucao);
}
*/
criarGeometria() {
return new THREE.PlaneGeometry(this.largura, this.altura);
}
criarMaterial() {
var mat = new THREE.MeshPhongMaterial();
mat.map = this.criarTexturaPintura(this.cfg.resolucao);
return mat;
}
/*
criarPintura() {
/*
this.material = new THREE.MeshPhongMaterial();
this.geometria = new THREE.PlaneGeometry(this.largura, this.altura);
this.malha = new THREE.Mesh(this.geometria, this.material);
this.object3d.add(this.malha);
*
/
}
*/
criarTexturaPintura(_resolucao) {
this.resolucao = _resolucao;
var _diretorio = "paint/" + this.autor + "/" + this.codigo;
var _nomeArquivo = this.codigo + "-" + this.resolucao + "." + this.ext;
var _mudarTextura = this.mudarTextura;
this.textura = new THREE.TextureLoader().load(_diretorio + "/" + _nomeArquivo);
//this.textura = THREE.ImageUtils.loadTexture(_diretorio + "/" + _nomeArquivo);
return this.textura;
//this.mudarTextura();
/*
this.textura = THREE.ImageUtils.loadTexture(
_diretorio + "/" + _nomeArquivo,
THREE.Texture.DEFAULT_MAPPING,
this.mudarTextura);
*/
}
/*
mudarTextura: function() {
this.material.map = this.textura;
}
carregarTextura: function(_textura) {
this.material.map = _textura;
}
*/
novaTextura(_resolucao) {
this.criarTexturaPintura(_resolucao);
}
}