Is it supposed to work for size different than 256x? Your example breaks for me if I change all 256s to 128s.
I am working on shader that'll support any data and tile textures and with 32x32 tiles.
I'll make a thread if I succeed.
Is it enough for your copyright if I paste a comment like that in my class code and publish my class and shaders?
//The code on which this class implementation and shader code is based are subject to following copyright notice:
//
// Copyright (c) 2012 by Mickaël Pointier.
// This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported license,
// http://creativecommons.org/licenses/by-sa/3.0/.
//
//Which is not included in shader source literals below to save space in final executable -FRex
Edit:
I think I might have done it, I need to add some things like mixing alpha of map with alpha of tile, using green channel to provide more data up to 32x32 spreadsheet and maybe use blue channel for something,
I'd appreciate anyone downloading and testing that exe(it's called SoundEngine by my mistake..):
https://docs.google.com/file/d/0B8dEkQw1a4WvVF96RW90WDhnRDg/edit?usp=sharing
In attachment there is sceen of correct output.
[attachment deleted by admin]
Is it supposed to work for size different than 256x? Your example breaks for me if I change all 256s to 128s.
I am working on shader that'll support any data and tile textures and with 32x32 tiles.
Yes it is possible. There are actually two ways to achieve that:
- Modify the shader constants so the computations to find the tile and texture work for the particular size
- Modify the shader code to get the textures dimensions that are passed as parameters
The first is easy but not flexible, the second will auto-magically works whatever sizes you give.
I had a prototype using the second method but it made the code very ugly and complex for no particular reason since in my case I had decided to use 256x256 tilemaps and sizes that are 32x32 tiles.
I'll make a thread if I succeed.
Is it enough for your copyright if I paste a comment like that in my class code and publish my class and shaders?
//The code on which this class implementation and shader code is based are subject to following copyright notice:
//
// Copyright (c) 2012 by Mickaël Pointier.
// This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported license,
// http://creativecommons.org/licenses/by-sa/3.0/.
//
//Which is not included in shader source literals below to save space in final executable -FRex
I guess that's fine, perhaps just add a link to my website? Like for example:
// Copyright (c) 2012 by Mickaël Pointier. (http://www.the2dgame.com)
Have fun!
(I tried your executable, it works fine here)