Texture.js 2.1 KB
Newer Older
M
Mr.doob 已提交
1 2
/**
 * @author mr.doob / http://mrdoob.com/
3
 * @author alteredq / http://alteredqualia.com/
4
 * @author szimek / https://github.com/szimek/
M
Mr.doob 已提交
5 6
 */

7
THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter ) {
M
Mr.doob 已提交
8

M
Mr.doob 已提交
9 10
	this.id = THREE.TextureCount ++;

M
Mr.doob 已提交
11
	this.image = image;
12

M
Mr.doob 已提交
13
	this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
14

15 16
	this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;
	this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;
M
Mr.doob 已提交
17

18 19
	this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;
	this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
20

21
	this.offset = new THREE.Vector2( 0, 0 );
22 23
	this.repeat = new THREE.Vector2( 1, 1 );

A
alteredq 已提交
24
	this.needsUpdate = false;
25

M
Mr.doob 已提交
26 27 28 29
};

THREE.Texture.prototype = {

30 31
	constructor: THREE.Texture,

32 33
	clone: function () {

34 35 36 37 38 39
		var clonedTexture = new THREE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter );

		clonedTexture.offset.copy( this.offset );
		clonedTexture.repeat.copy( this.repeat );

		return clonedTexture;
40

41
	}
M
Mr.doob 已提交
42 43

};
M
Mr.doob 已提交
44

M
Mr.doob 已提交
45 46
THREE.TextureCount = 0;

M
Mr.doob 已提交
47 48
THREE.MultiplyOperation = 0;
THREE.MixOperation = 1;
49

50 51 52 53 54 55 56 57 58 59 60 61 62
// Mapping modes

THREE.CubeReflectionMapping = function () {};
THREE.CubeRefractionMapping = function () {};

THREE.LatitudeReflectionMapping = function () {};
THREE.LatitudeRefractionMapping = function () {};

THREE.SphericalReflectionMapping = function () {};
THREE.SphericalRefractionMapping = function () {};

THREE.UVMapping = function () {};

63
// Wrapping modes
64

M
Mr.doob 已提交
65 66 67
THREE.RepeatWrapping = 0;
THREE.ClampToEdgeWrapping = 1;
THREE.MirroredRepeatWrapping = 2;
M
Mr.doob 已提交
68

69
// Filters
70

M
Mr.doob 已提交
71 72 73 74 75 76
THREE.NearestFilter = 3;
THREE.NearestMipMapNearestFilter = 4;
THREE.NearestMipMapLinearFilter = 5;
THREE.LinearFilter = 6;
THREE.LinearMipMapNearestFilter = 7;
THREE.LinearMipMapLinearFilter = 8;
77 78

// Types
79

80 81 82 83 84 85 86 87 88
THREE.ByteType = 9;
THREE.UnsignedByteType = 10;
THREE.ShortType = 11;
THREE.UnsignedShortType = 12;
THREE.IntType = 13;
THREE.UnsignedIntType = 14;
THREE.FloatType = 15;

// Formats
89

90 91 92 93 94
THREE.AlphaFormat = 16;
THREE.RGBFormat = 17;
THREE.RGBAFormat = 18;
THREE.LuminanceFormat = 19;
THREE.LuminanceAlphaFormat = 20;