About Store Forum Documentation Contact



Post Reply 
help with particles!
Author Message
craksy Offline
Member

Post: #1
help with particles!
ok i was taking a look at the particle tutorial, and on thing i didnt understand is this line:

Gfx *gfx =Gfxs("../data/gfx/particle/fire.gfx"); // image

why make it a pointer? i dont really see why :oops:
pointers is one thing about C++ i never understanded... i know how they work in theory, and can use them, but i dont see how it can be usefull :S

anyway, can you explain that to me?
ill also post here if i run into more problems, with the particle tutorial
01-03-2009 09:35 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
Re: help with particles!
Gxfs is a Cache of Textures (Gfx), it stores objects (textures) internally, so when it loads an object it can return a pointer to it
01-03-2009 09:45 PM
Find all posts by this user Quote this message in a reply
craksy Offline
Member

Post: #3
Re: help with particles!
aah, i see!

2 more questions:

1. in the fire example, what exactly makes it change color? in the buttom its yellow, but as it moves up, the particles turn red...
i dont really see anywhere that makes it do that!
did i miss something?

2. what is the difference between palette based, and alpha blending?
are there more kinds of particle rendering thingys, and how do i know, when to use which one? :S
01-03-2009 10:11 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
Re: help with particles!
the second question answers your first one
fire particle is rendered in pallette mode
this mode allows you the draw a color taken from a pallette texture, depending on the intensity of a particle
this pallette is by default stored in engine.pak, and loaded by the engine automatically (it has the fire fading color transparent->red->yellow)
you can replace the pallette to your custom texture
Renderer.particle_palette=Gfxs(".."); in Init() function
the texture must be of a 4 pixel height (because a maximum of 4 simultaneous palettes are available at a time, where each row represents a single palette)
01-03-2009 10:15 PM
Find all posts by this user Quote this message in a reply
craksy Offline
Member

Post: #5
Re: help with particles!
just another quick question, more about the vectors than particles though:

if i have a "distance" variable, set like this: Vec distance = point1.pos()-point2.pos();, and wanted to make a check on it how would i do it? like if i want to make sure that the max distance between to objects is Vec(1, 1, 1) or something?
could you just do it like: if(distance < Vec(1,1,1)){do stuff}?
or would you have to do it another way?

i know its bad explained, but couldnt think of another way, of explaining it :/
01-04-2009 06:05 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
Re: help with particles!
you can use Flt Dist(Vec a,Vec b) function
which returns a scalar floating point distance value between 2 points 'a' and 'b'
01-04-2009 06:11 PM
Find all posts by this user Quote this message in a reply
craksy Offline
Member

Post: #7
Re: help with particles!
wow... 36 argument types :/
but how would i do it for the example i gave before?
if(Dist(point1.pos, point2.pos)<1)){do stuff} ? :S
01-04-2009 06:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
Re: help with particles!
yes
01-04-2009 08:29 PM
Find all posts by this user Quote this message in a reply
Post Reply