|
|
@@ -12,11 +12,14 @@ import {
|
|
|
} from '../constants.js';
|
|
|
import { generateUUID } from '../math/MathUtils.js';
|
|
|
import { Vector2 } from '../math/Vector2.js';
|
|
|
+import { Vector3 } from '../math/Vector3.js';
|
|
|
import { Matrix3 } from '../math/Matrix3.js';
|
|
|
import { Source } from './Source.js';
|
|
|
|
|
|
let _textureId = 0;
|
|
|
|
|
|
+const _tempVec3 = /*@__PURE__*/ new Vector3();
|
|
|
+
|
|
|
/**
|
|
|
* Base class for all textures.
|
|
|
*
|
|
|
@@ -358,6 +361,33 @@ class Texture extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * The width of the texture in pixels.
|
|
|
+ */
|
|
|
+ get width() {
|
|
|
+
|
|
|
+ return this.source.getSize( _tempVec3 ).x;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The height of the texture in pixels.
|
|
|
+ */
|
|
|
+ get height() {
|
|
|
+
|
|
|
+ return this.source.getSize( _tempVec3 ).y;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The depth of the texture in pixels.
|
|
|
+ */
|
|
|
+ get depth() {
|
|
|
+
|
|
|
+ return this.source.getSize( _tempVec3 ).z;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* The image object holding the texture data.
|
|
|
*
|