Fixed flickering bug of ramp (all animations where sprites touch edge of their field)
This commit is contained in:
parent
313bfe4a41
commit
33275f9046
@ -1002,73 +1002,5 @@
|
||||
</stars>
|
||||
<energy x="19.086655" y="-0.40666655"/>
|
||||
</level>
|
||||
<level packId="1" id="17" goalX="3.0" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
|
||||
<terrainTiles class="java.util.ArrayList">
|
||||
<tileData x="0.0" width="6.0"/>
|
||||
</terrainTiles>
|
||||
<ceilingTiles class="java.util.ArrayList">
|
||||
<tileData x="0.0" width="6.0"/>
|
||||
</ceilingTiles>
|
||||
<obstacles class="java.util.ArrayList">
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-2.496666" rightEdge="-1.996666" height="0.5" y="-0.10333342">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.3033333" rightEdge="-0.8033333" height="0.5" y="0.16666666">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-0.5233333" rightEdge="-0.023333311" height="0.5" y="0.2733333">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.0033333302" rightEdge="0.50333333" height="0.5" y="0.23333332">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.2099999" rightEdge="-0.7099999" height="0.5" y="0.7266666">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.60333323" rightEdge="1.1033332" height="0.5" y="0.33333328">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.1099999" rightEdge="1.6099999" height="0.5" y="0.06666667">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.2633331" rightEdge="1.7633331" height="0.5" y="0.6533332">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-0.0766667" rightEdge="0.4233333" height="0.5" y="0.7666665">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.8766664" rightEdge="-1.3766664" height="0.5" y="0.32666665">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.6699997" rightEdge="2.1699996" height="0.5" y="0.019999985">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.0100002" rightEdge="2.5100002" height="0.5" y="0.61333334">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.243333" rightEdge="2.743333" height="0.5" y="0.026666671">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.5766666" rightEdge="1.0766666" height="0.5" y="0.87333333">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.6599987" rightEdge="3.1599987" height="0.5" y="0.54666656">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.9199991" rightEdge="3.4199991" height="0.5" y="-0.060000002">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.4199994" rightEdge="3.9199994" height="0.5" y="0.5266667">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.453332" rightEdge="3.953332" height="0.5" y="-0.32666662">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="4.0666656" rightEdge="4.5666656" height="0.5" y="0.10666664">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
</obstacles>
|
||||
<stars class="java.util.ArrayList"/>
|
||||
</level>
|
||||
</levels>
|
||||
</levelPack>
|
@ -9,24 +9,26 @@ const float clampBorder = 0.005;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex);
|
||||
vec2 getTexCoordsInAtlas(in vec2 clampedTexCoords, in float atlasIndex);
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texAtlasCoords = getTexCoordsInAtlas(texAtlasIndex);
|
||||
vec2 clampedTexCoords = pass_TexCoords;
|
||||
if(texAtlasSize.x > 1.0 || texAtlasSize.y > 1.0)
|
||||
texAtlasCoords = clamp(texAtlasCoords, clampBorder, 1.0 - clampBorder);
|
||||
clampedTexCoords = clamp(pass_TexCoords, clampBorder, 1.0 - clampBorder);
|
||||
|
||||
vec2 texAtlasCoords = getTexCoordsInAtlas(clampedTexCoords, texAtlasIndex);
|
||||
gl_FragColor = texture2D(texture, texAtlasCoords);
|
||||
gl_FragColor.a = min(gl_FragColor.a, alpha);
|
||||
|
||||
}
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex){
|
||||
vec2 getTexCoordsInAtlas(in vec2 clampedTexCoords, in float atlasIndex){
|
||||
|
||||
vec2 texAtlasCoords = vec2(0.0, 0.0);
|
||||
texAtlasCoords.x = mod(pass_TexCoords.x, 1.0) / texAtlasSize.x;
|
||||
texAtlasCoords.x = mod(clampedTexCoords.x, 1.0) / texAtlasSize.x;
|
||||
texAtlasCoords.x += mod(atlasIndex, texAtlasSize.x) / texAtlasSize.x;
|
||||
texAtlasCoords.y = mod(pass_TexCoords.y, 1.0) / texAtlasSize.y;
|
||||
texAtlasCoords.y = mod(clampedTexCoords.y, 1.0) / texAtlasSize.y;
|
||||
texAtlasCoords.y += floor(atlasIndex / texAtlasSize.y) / texAtlasSize.y;
|
||||
return texAtlasCoords;
|
||||
|
||||
|
Binary file not shown.
@ -1002,73 +1002,5 @@
|
||||
</stars>
|
||||
<energy x="19.086655" y="-0.40666655"/>
|
||||
</level>
|
||||
<level packId="1" id="17" goalX="3.0" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
|
||||
<terrainTiles class="java.util.ArrayList">
|
||||
<tileData x="0.0" width="6.0"/>
|
||||
</terrainTiles>
|
||||
<ceilingTiles class="java.util.ArrayList">
|
||||
<tileData x="0.0" width="6.0"/>
|
||||
</ceilingTiles>
|
||||
<obstacles class="java.util.ArrayList">
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-2.496666" rightEdge="-1.996666" height="0.5" y="-0.10333342">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.3033333" rightEdge="-0.8033333" height="0.5" y="0.16666666">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-0.5233333" rightEdge="-0.023333311" height="0.5" y="0.2733333">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.0033333302" rightEdge="0.50333333" height="0.5" y="0.23333332">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.2099999" rightEdge="-0.7099999" height="0.5" y="0.7266666">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.60333323" rightEdge="1.1033332" height="0.5" y="0.33333328">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.1099999" rightEdge="1.6099999" height="0.5" y="0.06666667">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.2633331" rightEdge="1.7633331" height="0.5" y="0.6533332">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-0.0766667" rightEdge="0.4233333" height="0.5" y="0.7666665">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.8766664" rightEdge="-1.3766664" height="0.5" y="0.32666665">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.6699997" rightEdge="2.1699996" height="0.5" y="0.019999985">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.0100002" rightEdge="2.5100002" height="0.5" y="0.61333334">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.243333" rightEdge="2.743333" height="0.5" y="0.026666671">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.5766666" rightEdge="1.0766666" height="0.5" y="0.87333333">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.6599987" rightEdge="3.1599987" height="0.5" y="0.54666656">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.9199991" rightEdge="3.4199991" height="0.5" y="-0.060000002">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.4199994" rightEdge="3.9199994" height="0.5" y="0.5266667">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.453332" rightEdge="3.953332" height="0.5" y="-0.32666662">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
<obstacleData floating="true" moving="false" deadly="false" leftEdge="4.0666656" rightEdge="4.5666656" height="0.5" y="0.10666664">
|
||||
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
|
||||
</obstacleData>
|
||||
</obstacles>
|
||||
<stars class="java.util.ArrayList"/>
|
||||
</level>
|
||||
</levels>
|
||||
</levelPack>
|
@ -9,24 +9,26 @@ const float clampBorder = 0.005;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex);
|
||||
vec2 getTexCoordsInAtlas(in vec2 clampedTexCoords, in float atlasIndex);
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texAtlasCoords = getTexCoordsInAtlas(texAtlasIndex);
|
||||
vec2 clampedTexCoords = pass_TexCoords;
|
||||
if(texAtlasSize.x > 1.0 || texAtlasSize.y > 1.0)
|
||||
texAtlasCoords = clamp(texAtlasCoords, clampBorder, 1.0 - clampBorder);
|
||||
clampedTexCoords = clamp(pass_TexCoords, clampBorder, 1.0 - clampBorder);
|
||||
|
||||
vec2 texAtlasCoords = getTexCoordsInAtlas(clampedTexCoords, texAtlasIndex);
|
||||
gl_FragColor = texture2D(texture, texAtlasCoords);
|
||||
gl_FragColor.a = min(gl_FragColor.a, alpha);
|
||||
|
||||
}
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex){
|
||||
vec2 getTexCoordsInAtlas(in vec2 clampedTexCoords, in float atlasIndex){
|
||||
|
||||
vec2 texAtlasCoords = vec2(0.0, 0.0);
|
||||
texAtlasCoords.x = mod(pass_TexCoords.x, 1.0) / texAtlasSize.x;
|
||||
texAtlasCoords.x = mod(clampedTexCoords.x, 1.0) / texAtlasSize.x;
|
||||
texAtlasCoords.x += mod(atlasIndex, texAtlasSize.x) / texAtlasSize.x;
|
||||
texAtlasCoords.y = mod(pass_TexCoords.y, 1.0) / texAtlasSize.y;
|
||||
texAtlasCoords.y = mod(clampedTexCoords.y, 1.0) / texAtlasSize.y;
|
||||
texAtlasCoords.y += floor(atlasIndex / texAtlasSize.y) / texAtlasSize.y;
|
||||
return texAtlasCoords;
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Loading…
x
Reference in New Issue
Block a user