Преглед изворни кода

GLTFLoader: Use Texture instead of CanvasTexture for ImageBitmaps (#21976)

Mr.doob пре 4 година
родитељ
комит
2383c1c0e4
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      examples/jsm/loaders/GLTFLoader.js

+ 5 - 2
examples/jsm/loaders/GLTFLoader.js

@@ -4,7 +4,6 @@ import {
 	Box3,
 	Box3,
 	BufferAttribute,
 	BufferAttribute,
 	BufferGeometry,
 	BufferGeometry,
-	CanvasTexture,
 	ClampToEdgeWrapping,
 	ClampToEdgeWrapping,
 	Color,
 	Color,
 	DirectionalLight,
 	DirectionalLight,
@@ -54,6 +53,7 @@ import {
 	Sphere,
 	Sphere,
 	SpotLight,
 	SpotLight,
 	TangentSpaceNormalMap,
 	TangentSpaceNormalMap,
+	Texture,
 	TextureLoader,
 	TextureLoader,
 	TriangleFanDrawMode,
 	TriangleFanDrawMode,
 	TriangleStripDrawMode,
 	TriangleStripDrawMode,
@@ -2598,7 +2598,10 @@ class GLTFParser {
 
 
 					onLoad = function ( imageBitmap ) {
 					onLoad = function ( imageBitmap ) {
 
 
-						resolve( new CanvasTexture( imageBitmap ) );
+						const texture = new Texture( imageBitmap );
+						texture.needsUpdate = true;
+
+						resolve( texture );
 
 
 					};
 					};