-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
463dc0b
commit dfa19c4
Showing
10 changed files
with
114 additions
and
77 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
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,34 @@ | ||
import { BucketPointer, BufferBucket } from '../buffer/buffer_bucket'; | ||
import { WebGl2ProgramType } from '../programs/program'; | ||
import { Vector2 } from '../types'; | ||
import { | ||
WebGl2Object, | ||
PrimitiveType, | ||
WebGl2ObjectAttributes, | ||
WebGl2ObjectDrawType, | ||
WebGl2ObjectDrawAttrs, | ||
} from './object'; | ||
|
||
export interface WebGl2TriangleAttributes extends WebGl2ObjectAttributes { | ||
p1: Vector2; | ||
p2: Vector2; | ||
p3: Vector2; | ||
} | ||
|
||
export class WebGl2Triangle extends WebGl2Object<WebGl2TriangleAttributes> { | ||
primitiveType = PrimitiveType.TRIANGLES; | ||
|
||
programType = WebGl2ProgramType.default; | ||
|
||
drawType = WebGl2ObjectDrawType.ARRAYS; | ||
|
||
bufferDataToBucket(bufferBucket: BufferBucket): BucketPointer { | ||
return bufferBucket.writeAndCommit([...this.attributes.p1, ...this.attributes.p2, ...this.attributes.p3]); | ||
} | ||
|
||
getDrawAttributes(): WebGl2ObjectDrawAttrs { | ||
return { | ||
numElements: 3, | ||
}; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#version 300 es | ||
precision lowp float; | ||
precision highp float; | ||
|
||
uniform vec4 u_color; | ||
|
||
|
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