Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed May 15, 2019
1 parent 5d215ca commit 77b481f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions modules/core/src/lib/base-attribute.js
Expand Up @@ -76,7 +76,7 @@ export default class BaseAttribute {

// Create buffer if needed
if (!constant && this.gl) {
this.buffer = this.buffer || this.createBuffer(opts);
this.buffer = this.buffer || this._createBuffer(opts);
this.buffer.setData({data: value});
this.type = this.buffer.accessor.type;
}
Expand All @@ -85,7 +85,25 @@ export default class BaseAttribute {
this._setAccessor(opts);
}

createBuffer(opts) {
getBuffer() {
if (this.constant) {
return null;
}
return this.externalBuffer || this.buffer;
}

getValue() {
if (this.constant) {
return this.value;
}
const buffer = this.externalBuffer || this.buffer;
if (buffer) {
return [buffer, this];
}
return null;
}

_createBuffer(opts) {
// Move accessor fields to accessor object
const props = Object.assign({}, opts, {
id: this.id,
Expand All @@ -106,24 +124,6 @@ export default class BaseAttribute {
return new Buffer(this.gl, props);
}

getBuffer() {
if (this.constant) {
return null;
}
return this.externalBuffer || this.buffer;
}

getValue() {
if (this.constant) {
return this.value;
}
const buffer = this.externalBuffer || this.buffer;
if (buffer) {
return [buffer, this];
}
return null;
}

// Sets all accessor props except type
// TODO - store on `this.accessor`
_setAccessor(opts) {
Expand Down

0 comments on commit 77b481f

Please sign in to comment.