Merge remote-tracking branch 'origin/master'

This commit is contained in:
ed
2024-02-07 15:23:49 -05:00
50 changed files with 3310 additions and 3050 deletions
-2
View File
@@ -120,7 +120,6 @@ when GL_DEBUG {
}
// Compiling shaders are identical for any shader (vertex, geometry, fragment, tesselation, (maybe compute too))
@private
compile_shader_from_source :: proc(shader_data: string, shader_type: Shader_Type) -> (shader_id: u32, ok: bool) {
shader_id = CreateShader(cast(u32)shader_type)
length := i32(len(shader_data))
@@ -134,7 +133,6 @@ compile_shader_from_source :: proc(shader_data: string, shader_type: Shader_Type
}
// only used once, but I'd just make a subprocedure(?) for consistency
@private
create_and_link_program :: proc(shader_ids: []u32, binary_retrievable := false) -> (program_id: u32, ok: bool) {
program_id = CreateProgram()
for id in shader_ids {
+2 -2
View File
@@ -1051,8 +1051,8 @@ foreign lib {
LoadShader :: proc(vsFileName, fsFileName: cstring) -> Shader --- // Load shader from files and bind default locations
LoadShaderFromMemory :: proc(vsCode, fsCode: cstring) -> Shader --- // Load shader from code strings and bind default locations
IsShaderReady :: proc(shader: Shader) -> bool --- // Check if a shader is ready
GetShaderLocation :: proc(shader: Shader, uniformName: cstring) -> c.int --- // Get shader uniform location
GetShaderLocationAttrib :: proc(shader: Shader, attribName: cstring) -> c.int --- // Get shader attribute location
GetShaderLocation :: proc(shader: Shader, uniformName: cstring) -> ShaderLocationIndex --- // Get shader uniform location
GetShaderLocationAttrib :: proc(shader: Shader, attribName: cstring) -> ShaderLocationIndex --- // Get shader attribute location
SetShaderValue :: proc(shader: Shader, locIndex: ShaderLocationIndex, value: rawptr, uniformType: ShaderUniformDataType) --- // Set shader uniform value
SetShaderValueV :: proc(shader: Shader, locIndex: ShaderLocationIndex, value: rawptr, uniformType: ShaderUniformDataType, count: c.int) --- // Set shader uniform value vector
SetShaderValueMatrix :: proc(shader: Shader, locIndex: ShaderLocationIndex, mat: Matrix) --- // Set shader uniform value (matrix 4x4)
+7 -6
View File
@@ -2,6 +2,7 @@ package webgl
foreign import "webgl2"
import "base:intrinsics"
import glm "core:math/linalg/glsl"
Query :: distinct u32
@@ -135,42 +136,42 @@ UniformMatrix3x2fv :: proc "contextless" (location: i32, m: glm.mat3x2) {
foreign webgl2 {
_UniformMatrix3x2fv :: proc "contextless" (location: i32, addr: [^]f32) ---
}
array := matrix_flatten(m)
array := intrinsics.matrix_flatten(m)
_UniformMatrix3x2fv(location, &array[0])
}
UniformMatrix4x2fv :: proc "contextless" (location: i32, m: glm.mat4x2) {
foreign webgl2 {
_UniformMatrix4x2fv :: proc "contextless" (location: i32, addr: [^]f32) ---
}
array := matrix_flatten(m)
array := intrinsics.matrix_flatten(m)
_UniformMatrix4x2fv(location, &array[0])
}
UniformMatrix2x3fv :: proc "contextless" (location: i32, m: glm.mat2x3) {
foreign webgl2 {
_UniformMatrix2x3fv :: proc "contextless" (location: i32, addr: [^]f32) ---
}
array := matrix_flatten(m)
array := intrinsics.matrix_flatten(m)
_UniformMatrix2x3fv(location, &array[0])
}
UniformMatrix4x3fv :: proc "contextless" (location: i32, m: glm.mat4x3) {
foreign webgl2 {
_UniformMatrix4x3fv :: proc "contextless" (location: i32, addr: [^]f32) ---
}
array := matrix_flatten(m)
array := intrinsics.matrix_flatten(m)
_UniformMatrix4x3fv(location, &array[0])
}
UniformMatrix2x4fv :: proc "contextless" (location: i32, m: glm.mat2x4) {
foreign webgl2 {
_UniformMatrix2x4fv :: proc "contextless" (location: i32, addr: [^]f32) ---
}
array := matrix_flatten(m)
array := intrinsics.matrix_flatten(m)
_UniformMatrix2x4fv(location, &array[0])
}
UniformMatrix3x4fv :: proc "contextless" (location: i32, m: glm.mat3x4) {
foreign webgl2 {
_UniformMatrix3x4fv :: proc "contextless" (location: i32, addr: [^]f32) ---
}
array := matrix_flatten(m)
array := intrinsics.matrix_flatten(m)
_UniformMatrix3x4fv(location, &array[0])
}