Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualWaterlimon

Posted 27 January 2013 - 11:38 AM

It doesnt require it.

Basically now you have for each vertex:
-Position
-Tex coord

and you need to add
-Animation (2 float components?)
*first component is amount of frames the animation has
*second component is speed of animation

For nonanimated tiles animation is 0,0

When drawing all the tiles, you pass a "Time" uniform to the shader.

In the shader, you add to the tex coords
texCoord.x=texCoord.x + float(((time*animationSpeed)%keyframes))*widthOfTileTexture

so normal tiles are normal. But animated tiles take 1 texture from a row of textures of specified size (in the same tile sheet as normal tiles) depending on time

edit:

so basically to get a tile animated, in your tile sheet you place the animation sequence of the tile on a horizontal row. then in the vertex attribute (the animation one) you set how many tiles long the sequence is, and how fast it should play.

#1Waterlimon

Posted 27 January 2013 - 11:31 AM

It doesnt require it.

 

Basically now you have for each vertex:

-Position

-Tex coord

 

and you need to add

-Animation (2 float components?)

*first component is amount of frames the animation has

*second component is speed of animation

 

For nonanimated tiles animation is 0,0

 

When drawing all the tiles, you pass a "Time" uniform to the shader.

 

In the shader, you add to the tex coords

texCoord.x=texCoord.x + float(((time*animationSpeed)%keyframes))*widthOfTileTexture

 

so normal tiles are normal. But animated tiles take 1 texture from a row of textures of specified size (in the same tile sheet as normal tiles) depending on time


PARTNERS