Page 1 of 2

Tesselated Image

Posted: Mon May 17, 2010 8:51 am
by Airo
Hi,

I have created a class which reads a picture readable by Irrlicht of abitrary size and splits it into several parts depending on max objects that should be used. The parts will be placed to a random position within given borders with random colors and are animated to the given destination by changing their position and color step by step.

Here is the original thread where aek came up with his idea which I liked so much and inspired me to create the class:
http://irrlicht.sourceforge.net/phpBB2/ ... sc&start=0

Here comes my post from the original thread:

It is a class which can be parameterized as follows

Code: Select all

//! Splits an image readable by Irrlicht of abitrary size into several parts and animates these parts from a given starting position to a given target destination.
class TesselatedImage

//! Constructor.
/*! @param img       - The path to the image.
    @param startFr   - Vector defining the left(x1)/bottom(y1)/front(z1) position of the cube within the parts are being randomly positioned.
    @param startTo   - Vector defining the right(x2)/top(y2)/behind(z2) position of the cube with x2 > x1, y2 > y1, z2 > z1.
    @param targetPos - The bottom left position of the final compound image.
    @param speed     - Amount of units per seconds a part is moving to its target position.
    @param maxTes    - The maximum number of parts that should be used to split the image. If resolutionX * resolutionY < maxTes then a part represents more than one pixel.
    @param colChange - How quickly a part can correct its color to reach the final color, defined in 'one unit per RGB' per second.
    @param type      - What the parts should be made of, default is using a Billboard.
    @param dim       - The quadratic dimension of the billboard or the radius of the sphere. See parameter type.
    @param gap       - The gap between parts.
*/
TesselatedImage(stringc img, vector3df startFr, vector3df startTo, vector3df targetPos, float speed=10.0f, int maxTes=5000, float colChange=5.0, Type type=Billboard, float dim=4.0f, float gap=0.05f);
It can be used as follows:

Code: Select all

TesselatedImage *tesImage = new TesselatedImage(<your image>, vector3df(-600,0,500), vector3df(500, 550, 1000), vector3df(-130,50,100), 45, 15000, 10);
tesImage->startAnimation();
then call tesImage->move(<time elapsed in seconds>) to let the parts move to the destination.

and do

Code: Select all

if (tesImage->hasAnimationFinished())
{
    tesImage->reset();
    tesImage->startAnimation();
}
to reset the positions and colors to random values and start again.

Note: to get it running you need an instance to the Irrlicht driver (I have used a Singleton here to get it), exchange

Code: Select all

#include "graphicsirr.h"
...
GraphicsIrr *graphics = GraphicsIrr::getInstance();
with your Irrlicht #include code to be able to make driver calls like
Code:

Code: Select all

IImage *image = graphics->driver->createImageFromFile(img.c_str());
Here is the link
http://www.mediafire.com/file/j2mzmymyw ... dImage.rar

I have never used a free hosting service until now, tried it, works, hope the link keeps working.

Have fun and thanks again to aek for his brilliant idea. :-)

ciao
Airo

Posted: Tue May 18, 2010 5:07 am
by Midnight
wicked, haven't seen aeks code yet but I'm guess he did most of the work. at any rate I love to see working projects and code snippets and know the work involved with any project. just hoping you licensed it like so many others neglect.

Posted: Tue May 18, 2010 8:17 am
by Airo
Hi,

it's definitely Aek's "work" regarding the idea and the explanation how he implemented it (see the discussion in the original thread). When I started I didn't have any code from him, so I implemented it on my own, extended it a bit (i.e. using arbitrary sizes) and made a class out of it so everybody can easily use it.

Regarding license, I didn't mention it maybe clearly enough, but every piece of code I am going to contribute is free for all, can be used in what ever way. If I should once decide to post code under a different license I am going to state it explicitly. Hope that makes things clear.

Posted: Tue May 18, 2010 2:45 pm
by Dorth
Dude, put MIT or zlib then, else, with what you wrote, I could claim ownership...

Posted: Tue May 18, 2010 3:28 pm
by Airo
To be honest, I would not care about someone claiming ownership (in the sense of "adorning oneself with borrowed plumes") as long as it does not restrict others to use it. I have searched around, but I am not sure which one it is (zlib, MIT, BSD, ...?), so look for the most permissive free license .. and voila that it is.

I finally found a license that seems to suite my needs (someone in the Irrlicht forum has posted the link to it). ;-)

http://sam.zoy.org/wtfpl/

Posted: Tue May 18, 2010 6:10 pm
by Midnight
"To be honest, I would not care about someone claiming ownership"

That's exactly how I took it, basically he's claimed public domain already Dorth. And no you can't claim poop because the evidence is already here, if you wanted to claim it you'd need proof beyond reasonable doubt and a lawsuit to secure anything other then public domain on your end.

It doesn't bother me when someone doesn't include a license, unless they exclude a phrase like above, and it's because I can't be clear of their wishes, it's rude, gives me no legal stance at all, and just kind of lazy.

The way Airo put it is the minimal I would expect, and Airo don't think I was calling your work a ripoff or anything, I was just trying to point out that I had no idea how much of the work itself was actually his and couldn't comment on it without investigating it.

Posted: Tue May 18, 2010 6:16 pm
by Midnight
oh and this license is really badass Airo lol

However, unless you include it with the files, or state that it falls under this license, the license doesn't apply. It's all legal stuff that most people don't want to adhere to out of laziness/frustration. I'm not even sure this license would hold up in a court, if I had the ability to do wtf I wanted to what is to stop me from claiming it as my own and keeping anyone else from using it?

MIT/zlib/public domain.. still better then this license, but not as badass!

Posted: Tue May 18, 2010 8:48 pm
by greenya
There are two types of people:
the first think: if there is no free-license -- it is not free.
the second think: if there is no restrictive license -- it is free.

personally i belong to second group because i think if author would like to restrict access to the code -- he would think about license and add it, if he don't -- than its free. if he forgot -- OK, but at the moment when you taking a copy and doing with it what you want -- its unlicensed, so free.

Posted: Wed May 19, 2010 7:59 am
by kazymjir
I have an idea.
My code is licensed under GNU GPL.
Maybe we can use Airo code, as uprgade of my code, and release it as a new version?
Whole project will be as work group under GNU GPL.
It's free, non-restrective license, so everyone will be able to use this code for own projects, and modify it for own purposes.
What do you think about it?

Posted: Wed May 19, 2010 11:13 am
by hybrid
Hmm, in that case there's no chance to put this into the Irrlicht examples - we'd need zlib.

Posted: Wed May 19, 2010 8:15 pm
by Dorth
GNU is one of the most restrictive license out there :)

Posted: Wed May 19, 2010 8:54 pm
by bitplane
midnight wrote:I'm not even sure this license would hold up in a court, if I had the ability to do wtf I wanted to what is to stop me from claiming it as my own and keeping anyone else from using it?
Anything created with significant creative input is covered by copyright, you may not use it without explicit permission from the copyright holder. The WTFPL gives this permission, so it will hold up in a court of law. It's like a PD declaration (for example CC0) and it is recognised by opensource.org. Someone is free to lie and pretend that they wrote it without being in breach of a license (and therefore commit a copyright infringement), which may make other people worry about using it, but to claim so in a court of law would be perjury.

The one thing that the WTFPL or PD declaration doesn't protect you from is someone saying that your code crashed their computer and cost them money, so they could sue you. You really need a separate "no warranty" clause to be protected from this (the BSD, MIT and zlib licenses have this).

Posted: Wed May 19, 2010 9:03 pm
by bitplane
greenya wrote:if he don't -- than its free. if he forgot -- OK, but at the moment when you taking a copy and doing with it what you want -- its unlicensed, so free.
No, you need permission either explicit or implied. Websites often don't have copyright notices on them but you can't just copy/paste people's site and images without explicit written permission. When you're posting to a public forum (like this one or a newsgroup) some people take that to mean it's an implicit public domain declaration, but this is a very US-centric thing, many countries don't even recognise "PD"

So you're on thin ice if you use copypasta without a valid license or written permission, for example if you were to submit patches to Irrlicht and it turns out you'd plagiarised the code, we'd remove your contribution, shitlist you and ignore anything else you ever posted. Such a cowboy attitude towards such things could see all of us sued for breach of copyright, so we have to take it very seriously.

Posted: Thu May 20, 2010 12:35 am
by kazymjir
hybrid wrote:Hmm, in that case there's no chance to put this into the Irrlicht examples - we'd need zlib.
I read about zlib, looks to be good for this situation.
So, we can change license to zlib and claim it as group work.

Posted: Sun May 23, 2010 9:54 am
by netpipe
http://www.xup.in/dl,21160254/tesselatedImage2.7z/

hmm what did i do wrong trying to implement this ?

there's no color and the balls seem to go on forever.