Archived

This topic is now archived and is closed to further replies.

NickKirt

vc6.0 and data structure question

Recommended Posts

NickKirt    100
Hi all. first of all. NeHe''s site is cool. question: I have a class that calls another class. but when i call it it says it''s not there. Particle particle = new Particle(); for example. it says it''s not there but it is definately there and compiled properly. I use Microsoft visual studio c++ 6.0. do i have to tell it where to find the file or something???? another question. I want to program a particle engine. Nehe''s tutorial is good but i don''t think the data structure is very reusable. Does anyone have any good ideas on what kindof data structure I would need. I think a good oo approach with vectors(the push pop ones. not the xyz ones) would work good. So i can just say, a group of particles there. and add another group with totally different properties somewhere else very easily. thx NICK

Share this post


Link to post
Share on other sites
Crispy    556
quote:
Original post by NickKirt
I have a class that calls another class. but when i call it it says it''s not there.
Particle particle = new Particle();
for example. it says it''s not there but it is definately there and compiled properly.
I use Microsoft visual studio c++ 6.0. do i have to tell it where to find the file or something????



Shouldn''t it be Particle* particle = new Particle;

You could also try posting the actual error message.

quote:

another question. I want to program a particle engine. Nehe''s tutorial is good but i don''t think the data structure is very reusable. Does anyone have any good ideas on what kindof data structure I would need. I think a good oo approach with vectors(the push pop ones. not the xyz ones) would work good. So i can just say, a group of particles there. and add another group with totally different properties somewhere else very easily.



What do you mean by data structure. If you want to make everything OO, I''m afraid you won''t have too many places to use as a reference as far as Nehe''s tuts are involved.

As for a particle engine, you could probably get aways with something as simple as:


class TParticleBase
{
protected:
TVector3f* Particles;

int NumParticles;
DWORD Type;

public:
TParticleBase() { };

virtual void Render() { };
virtual void Iterate() { };
}

class TParticleFire : public TParticleBase
{
private:
TColor ColorFire;
TColor ColorFlame;
float Falloff;
TVector3f Direction;
/*any other variables you might want*/

public:
void Render()
{
//draw your fancy fire here

}

void Iterate()
{
//claculate new particle positions (based on time elapsed, for instance)

}
}

class TParticleHalo : public TPasrticleBase
{
//bla-bla - mostly same as TParticleFire

}

void WinMain(...)
{

TParticleBase* Flame = new TParticleFire;
TParticleBase* Halo = new TParticleHalo;

while(true)
{
glTranslate(pos_of_flame);
Flame->Iterate();
Flame->Render();
glTranslate(pos_of_halo);
Halo->Iterate();
Halo->Render();
}
}



The above is a quick mock-up and probably full of typos (it''s partly pseudocode so beware of copy-pasting )

Hope this helps you a little.

Share this post


Link to post
Share on other sites