-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from gkjohnson/set-type
Add support for changing the attribute buffer type for TypedBackedArray
- Loading branch information
Showing
5 changed files
with
94 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Brush, Evaluator, SUBTRACTION } from '../src'; | ||
import { SphereGeometry, BufferAttribute } from 'three'; | ||
|
||
describe( 'Evaluator', () => { | ||
|
||
it( 'it not fail if multiple operations with different buffer types.', () => { | ||
|
||
const geo1 = new SphereGeometry(); | ||
const geo2 = new SphereGeometry(); | ||
geo2.setAttribute( | ||
'uv', | ||
new BufferAttribute( new Uint8Array( geo2.attributes.uv.array.length ), 2, true ), | ||
); | ||
|
||
const brush1A = new Brush( geo1 ); | ||
const brush1B = new Brush( geo1 ); | ||
|
||
const brush2A = new Brush( geo2 ); | ||
const brush2B = new Brush( geo2 ); | ||
|
||
const evaluator = new Evaluator(); | ||
const result1 = evaluator.evaluate( brush1A, brush1B, SUBTRACTION ); | ||
const result2 = evaluator.evaluate( brush2A, brush2B, SUBTRACTION ); | ||
|
||
expect( result1.geometry.attributes.uv.array.constructor ).toBe( Float32Array ); | ||
expect( result2.geometry.attributes.uv.array.constructor ).toBe( Uint8Array ); | ||
|
||
} ); | ||
|
||
} ); |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe( 'TypeBackedArray', () => { | ||
|
||
it.todo( 'make tests' ); | ||
|
||
} ); |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe( 'TypedAttributeData', () => { | ||
|
||
it.todo( 'make tests' ); | ||
|
||
} ); |