@renderlayer/textures 0.0.2 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/textures.esm-bundler.js +49 -3
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ImageUtils, ClampToEdgeWrapping, LinearFilter, LinearMipmapLinearFilter, RGBAFormat, UnsignedByteType, NoColorSpace, UVMapping, MirroredRepeatWrapping, RepeatWrapping } from '@renderlayer/shared';
|
|
2
|
-
import { generateUUID, Vector2, Matrix3 } from '@renderlayer/math';
|
|
1
|
+
import { ImageUtils, ClampToEdgeWrapping, LinearFilter, LinearMipmapLinearFilter, RGBAFormat, UnsignedByteType, NoColorSpace, UVMapping, MirroredRepeatWrapping, RepeatWrapping, CubeReflectionMapping, NearestFilter } from '@renderlayer/shared';
|
|
3
2
|
import { EventDispatcher } from '@renderlayer/core';
|
|
3
|
+
import { generateUUID, Vector2, Matrix3 } from '@renderlayer/math';
|
|
4
4
|
|
|
5
|
+
let sourceid = 0;
|
|
5
6
|
class Source {
|
|
6
7
|
constructor(data = null) {
|
|
7
8
|
this.isSource = true;
|
|
9
|
+
Object.defineProperty(this, "id", { value: sourceid++ });
|
|
8
10
|
this.uuid = generateUUID();
|
|
9
11
|
this.data = data;
|
|
10
12
|
this.version = 0;
|
|
@@ -246,4 +248,48 @@ Texture.DEFAULT_IMAGE = null;
|
|
|
246
248
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
247
249
|
Texture.DEFAULT_ANISOTROPY = 1;
|
|
248
250
|
|
|
249
|
-
|
|
251
|
+
class CubeTexture extends Texture {
|
|
252
|
+
constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace) {
|
|
253
|
+
images = images !== void 0 ? images : [];
|
|
254
|
+
mapping = mapping !== void 0 ? mapping : CubeReflectionMapping;
|
|
255
|
+
super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace);
|
|
256
|
+
this.isCubeTexture = true;
|
|
257
|
+
this.flipY = false;
|
|
258
|
+
}
|
|
259
|
+
get images() {
|
|
260
|
+
return this.image;
|
|
261
|
+
}
|
|
262
|
+
set images(value) {
|
|
263
|
+
this.image = value;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class Data3DTexture extends Texture {
|
|
268
|
+
constructor(data = null, width = 1, height = 1, depth = 1) {
|
|
269
|
+
super(null);
|
|
270
|
+
this.isData3DTexture = true;
|
|
271
|
+
this.image = { data, width, height, depth };
|
|
272
|
+
this.magFilter = NearestFilter;
|
|
273
|
+
this.minFilter = NearestFilter;
|
|
274
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
275
|
+
this.generateMipmaps = false;
|
|
276
|
+
this.flipY = false;
|
|
277
|
+
this.unpackAlignment = 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
class DataArrayTexture extends Texture {
|
|
282
|
+
constructor(data = null, width = 1, height = 1, depth = 1) {
|
|
283
|
+
super(null);
|
|
284
|
+
this.isDataArrayTexture = true;
|
|
285
|
+
this.image = { data, width, height, depth };
|
|
286
|
+
this.magFilter = NearestFilter;
|
|
287
|
+
this.minFilter = NearestFilter;
|
|
288
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
289
|
+
this.generateMipmaps = false;
|
|
290
|
+
this.flipY = false;
|
|
291
|
+
this.unpackAlignment = 1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export { CubeTexture, Data3DTexture, DataArrayTexture, Source, Texture };
|