-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed Buffer2 shim and serialization
- Loading branch information
Lucas Wojciechowski
committed
Sep 23, 2015
1 parent
a9a9010
commit 0c01274
Showing
4 changed files
with
47 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
'use strict'; | ||
|
||
var util = require('../../util/util'); | ||
var Buffer = require('./buffer'); | ||
|
||
module.exports = TriangleElementBuffer; | ||
|
||
function TriangleElementBuffer(buffer) { | ||
Buffer.call(this, buffer); | ||
var Buffer2 = require('../buffer2'); | ||
|
||
function TriangleElementBuffer(options) { | ||
Buffer2.call(this, options || { | ||
type: Buffer2.BufferType.ELEMENT, | ||
attributes: { | ||
verticies: { | ||
components: 3, | ||
type: Buffer2.AttributeType.UNSIGNED_SHORT | ||
} | ||
} | ||
}); | ||
} | ||
|
||
TriangleElementBuffer.prototype = util.inherit(Buffer, { | ||
itemSize: 6, // bytes per triangle (3 * unsigned short == 6 bytes) | ||
arrayType: 'ELEMENT_ARRAY_BUFFER', | ||
|
||
TriangleElementBuffer.prototype = util.inherit(Buffer2, { | ||
add: function(a, b, c) { | ||
var pos2 = this.pos / 2; | ||
|
||
this.resize(); | ||
|
||
this.ushorts[pos2 + 0] = a; | ||
this.ushorts[pos2 + 1] = b; | ||
this.ushorts[pos2 + 2] = c; | ||
|
||
this.pos += this.itemSize; | ||
this.push([a, b, c]); | ||
} | ||
}); | ||
|
||
module.exports = TriangleElementBuffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters