Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信小程序AR基于three.js加载模型纹理失败,显示黑色 #12

Open
WuxiyiYanis opened this issue Feb 3, 2023 · 0 comments

Comments

@WuxiyiYanis
Copy link

//加载cube
const geometry = new THREE.BoxBufferGeometry(0.2, 0.2, 0.2);
/* This doesn't work on iOS because of Uint8ClampedArray bug:
https://developers.weixin.qq.com/community/develop/doc/000408d4f304e038c20e4a00a51400
/
/

const rgbaData = new Uint8ClampedArray([
255,255,255,0,
0,0,0,0,
0,0,0,0,
255,255,255,0
]);*/

const rgbaData = new Uint8Array([
255,255,255,0,
0,0,0,0,
0,0,0,0,
255,255,255,0
]);

const texture = new THREE.DataTexture(rgbaData,2,2);
texture.needsUpdate = true;

const material = new THREE.MeshBasicMaterial({ map: texture });

const mesh = new THREE.Mesh(geometry, material);
mainModel = mesh;
scene.add(mesh);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant