diff --git a/assets/shaders/mask.fs b/assets/shaders/mask.fs index c2abd05b..1260ff93 100644 --- a/assets/shaders/mask.fs +++ b/assets/shaders/mask.fs @@ -4,14 +4,20 @@ precision mediump float; // Input vertex attributes (from vertex shader) varying vec3 fragPosition; +varying vec2 fragTexCoord; +uniform sampler2D texture0; uniform float alpha; void main() { // Texel color fetching from texture sampler // NOTE: Implement here your fragment shader code + vec4 tmp = texture2D(texture0, fragTexCoord); - gl_FragColor = vec4(fragPosition, alpha); + tmp.a = alpha; + + gl_FragColor = tmp; + //gl_FragColor = vec4(fragColor.r, fragColor.g, fragColor.b, alpha); } \ No newline at end of file diff --git a/assets/shaders/mask.vs b/assets/shaders/mask.vs index f7a7bd38..a321dcec 100644 --- a/assets/shaders/mask.vs +++ b/assets/shaders/mask.vs @@ -96,12 +96,16 @@ uniform float radius; // Output vertex attributes (to fragment shader) varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec4 fragColor; // NOTE: Add here your custom variables void main() { // Send vertex attributes to fragment shader fragPosition = vertexPosition + vertexPosition * vec3(cnoise(vec3(vertexNormal + vec3(frame))) * 0.5); + fragColor = vertexColor; + fragTexCoord = vertexTexCoord; // Calculate final vertex position gl_Position = mvp * vec4(fragPosition , radius); //gl_Position = vec4(vertexNormal, 1.0); diff --git a/sources/System/BombHolder/BombHolderSystem.cpp b/sources/System/BombHolder/BombHolderSystem.cpp index edbf3582..17a92885 100644 --- a/sources/System/BombHolder/BombHolderSystem.cpp +++ b/sources/System/BombHolder/BombHolderSystem.cpp @@ -58,7 +58,7 @@ namespace BBM if (duration_cast(ctx.clock).count() <= 10) return; ctx.clock = 0ns; - ctx.explosionRadius -= 1; + ctx.explosionRadius -= 0.6; if (ctx.explosionRadius < BombExplosionShaderComponent::maxRadius) { ctx.explosionRadius = BombExplosionShaderComponent::maxRadius; ctx.alpha -= 0.1; @@ -73,7 +73,11 @@ namespace BBM .addComponent(500ms, [](WAL::Entity &explosion, WAL::Wal &wal) { explosion.scheduleDeletion(); }) - .addComponent(GenMeshSphere(0.5, 16, 16)); + .addComponent(GenMeshSphere(0.5, 16, 16), + std::make_pair( + MAP_DIFFUSE, + "assets/bombs/explosion/blast.png" + )); /*.addComponent("assets/bombs/explosion/explosion.glb", false, std::make_pair( MAP_DIFFUSE,