Skip to content

Commit 6e62ada

Browse files
committed
Created new MeshLight class
1 parent 307cbe1 commit 6e62ada

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

src/gameobjects/mesh/MeshLight.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2020 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
var Class = require('../../utils/Class');
8+
var Vector3 = require('../../math/Vector3');
9+
10+
/**
11+
* @classdesc
12+
* The Mesh Light.
13+
*
14+
* @class MeshLight
15+
* @memberof Phaser.GameObjects
16+
* @constructor
17+
* @since 3.50.0
18+
*/
19+
var MeshLight = new Class({
20+
21+
initialize:
22+
23+
function MeshLight (x, y, z)
24+
{
25+
this.position = new Vector3(x, y, z);
26+
this.ambient = new Vector3(1, 1, 1);
27+
this.diffuse = new Vector3(1, 1, 1);
28+
this.specular = new Vector3(1, 1, 1);
29+
},
30+
31+
setPosition: function (x, y, z)
32+
{
33+
this.position.set(x, y, z);
34+
35+
return this;
36+
},
37+
38+
setAmbient: function (r, g, b)
39+
{
40+
this.ambient.set(r, g, b);
41+
42+
return this;
43+
},
44+
45+
setDiffuse: function (r, g, b)
46+
{
47+
this.diffuse.set(r, g, b);
48+
49+
return this;
50+
},
51+
52+
setSpecular: function (r, g, b)
53+
{
54+
this.specular.set(r, g, b);
55+
56+
return this;
57+
},
58+
59+
x: {
60+
61+
get: function ()
62+
{
63+
return this.position.x;
64+
},
65+
66+
set: function (value)
67+
{
68+
this.position.x = value;
69+
}
70+
71+
},
72+
73+
y: {
74+
75+
get: function ()
76+
{
77+
return this.position.y;
78+
},
79+
80+
set: function (value)
81+
{
82+
this.position.y = value;
83+
}
84+
85+
},
86+
87+
z: {
88+
89+
get: function ()
90+
{
91+
return this.position.z;
92+
},
93+
94+
set: function (value)
95+
{
96+
this.position.z = value;
97+
}
98+
99+
}
100+
101+
});
102+
103+
module.exports = MeshLight;

0 commit comments

Comments
 (0)