start to dig into common objects

beta.r3js.org
Theunis J. Botha 2016-12-05 16:40:26 +01:00
parent b543c586e4
commit 8a932fc9e0
2 changed files with 17 additions and 18 deletions

View File

@ -279,19 +279,18 @@ GameLib.D3.Material.prototype.createInstance = function(update) {
if (update) {
for (var property in instance) {
if (property == 'size') {
instance[property] = this.pointSize;
}
if (property == 'sizeAttenuation') {
instance[property] = this.pointSizeAttenuation;
}
if (
this.hasOwnProperty(property) &&
instance.hasOwnProperty(property)
instance.hasOwnProperty(property) &&
this.hasOwnProperty(property)
) {
if (property == 'size') {
instance[property] = this.pointSize;
}
if (property == 'sizeAttenuation') {
instance[property] = this.pointSizeAttenuation;
}
if (instance[property] instanceof THREE.Color) {
instance[property].copy(this[property])
} else {

View File

@ -1,16 +1,16 @@
/**
* Runtime vector3 for updating instance objects
* Runtime apiVector3 for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param parentObject GameLib.D3.*
* @param vector3 GameLib.D3.API.Vector3
* @param apiVector3 GameLib.D3.API.Vector3
* @param grain Number
* @constructor
*/
GameLib.D3.Vector3 = function RuntimeVector3(graphics, parentObject, vector3, grain) {
GameLib.D3.Vector3 = function RuntimeVector3(graphics, parentObject, apiVector3, grain) {
for (var property in vector3) {
if (vector3.hasOwnProperty(property)) {
this[property] = vector3[property];
for (var property in apiVector3) {
if (apiVector3.hasOwnProperty(property)) {
this[property] = apiVector3[property];
}
}
@ -45,7 +45,7 @@ GameLib.D3.Vector3.prototype.createInstance = function(update) {
instance.y = this.y;
instance.z = this.z;
} else {
instance = new this.graphics.instance.Vector3(this.x, this.y, this.z);
instance = new THREE.Vector3(this.x, this.y, this.z);
}
return instance;