Minor refactorings
All checks were successful
Build and Publish WASM version of demo / Build-And-Deploy (push) Successful in 25s
All checks were successful
Build and Publish WASM version of demo / Build-And-Deploy (push) Successful in 25s
This commit is contained in:
parent
32f5440a24
commit
247fc8c74b
1 changed files with 13 additions and 13 deletions
|
@ -132,7 +132,7 @@ void ElectricityEffect::draw(Color color, Camera *camera) {
|
||||||
update_shader_sides(q0, q1, q2, q3, Vector2Distance(q0, q2));
|
update_shader_sides(q0, q1, q2, q3, Vector2Distance(q0, q2));
|
||||||
|
|
||||||
// Draw with shader.
|
// Draw with shader.
|
||||||
BeginShaderMode(shader.value());
|
BeginShaderMode(get_shader());
|
||||||
DrawTriangle3D(quad[0], quad[1], quad[2], color);
|
DrawTriangle3D(quad[0], quad[1], quad[2], color);
|
||||||
DrawTriangle3D(quad[0], quad[2], quad[3], color);
|
DrawTriangle3D(quad[0], quad[2], quad[3], color);
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
@ -158,10 +158,10 @@ void ElectricityEffect::update_shader_height() {
|
||||||
if (!shader.has_value()) {
|
if (!shader.has_value()) {
|
||||||
init_shader();
|
init_shader();
|
||||||
}
|
}
|
||||||
int uniform_loc = GetShaderLocation(shader.value(), "screen_height");
|
int uniform_loc = GetShaderLocation(get_shader(), "screen_height");
|
||||||
float height = GetScreenHeight();
|
float height = GetScreenHeight();
|
||||||
DEBUG_PRINT_FLOAT(height);
|
DEBUG_PRINT_FLOAT(height);
|
||||||
SetShaderValue(shader.value(), uniform_loc, &height, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(get_shader(), uniform_loc, &height, SHADER_UNIFORM_FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectricityEffect::update_shader_sides(Vector2 a, Vector2 adir, Vector2 b,
|
void ElectricityEffect::update_shader_sides(Vector2 a, Vector2 adir, Vector2 b,
|
||||||
|
@ -169,21 +169,21 @@ void ElectricityEffect::update_shader_sides(Vector2 a, Vector2 adir, Vector2 b,
|
||||||
if (!shader.has_value()) {
|
if (!shader.has_value()) {
|
||||||
init_shader();
|
init_shader();
|
||||||
}
|
}
|
||||||
int uniform_loc = GetShaderLocation(shader.value(), "sidePosA");
|
int uniform_loc = GetShaderLocation(get_shader(), "sidePosA");
|
||||||
DEBUG_PRINT_VEC2(a);
|
DEBUG_PRINT_VEC2(a);
|
||||||
SetShaderValue(shader.value(), uniform_loc, &a, SHADER_UNIFORM_VEC2);
|
SetShaderValue(get_shader(), uniform_loc, &a, SHADER_UNIFORM_VEC2);
|
||||||
uniform_loc = GetShaderLocation(shader.value(), "sideDirA");
|
uniform_loc = GetShaderLocation(get_shader(), "sideDirA");
|
||||||
DEBUG_PRINT_VEC2(adir);
|
DEBUG_PRINT_VEC2(adir);
|
||||||
SetShaderValue(shader.value(), uniform_loc, &adir, SHADER_UNIFORM_VEC2);
|
SetShaderValue(get_shader(), uniform_loc, &adir, SHADER_UNIFORM_VEC2);
|
||||||
uniform_loc = GetShaderLocation(shader.value(), "sidePosB");
|
uniform_loc = GetShaderLocation(get_shader(), "sidePosB");
|
||||||
DEBUG_PRINT_VEC2(b);
|
DEBUG_PRINT_VEC2(b);
|
||||||
SetShaderValue(shader.value(), uniform_loc, &b, SHADER_UNIFORM_VEC2);
|
SetShaderValue(get_shader(), uniform_loc, &b, SHADER_UNIFORM_VEC2);
|
||||||
uniform_loc = GetShaderLocation(shader.value(), "sideDirB");
|
uniform_loc = GetShaderLocation(get_shader(), "sideDirB");
|
||||||
DEBUG_PRINT_VEC2(bdir);
|
DEBUG_PRINT_VEC2(bdir);
|
||||||
SetShaderValue(shader.value(), uniform_loc, &bdir, SHADER_UNIFORM_VEC2);
|
SetShaderValue(get_shader(), uniform_loc, &bdir, SHADER_UNIFORM_VEC2);
|
||||||
uniform_loc = GetShaderLocation(shader.value(), "width");
|
uniform_loc = GetShaderLocation(get_shader(), "width");
|
||||||
DEBUG_PRINT_FLOAT(width);
|
DEBUG_PRINT_FLOAT(width);
|
||||||
SetShaderValue(shader.value(), uniform_loc, &width, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(get_shader(), uniform_loc, &width, SHADER_UNIFORM_FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectricityEffect::init_shader() {
|
void ElectricityEffect::init_shader() {
|
||||||
|
|
Loading…
Reference in a new issue