I have recently begun programming in C++ With the DirectX libraries. The examples I have been following are working well for me, but they were all coded in one main cpp file, so I've started moving them out into classes.
Specifically I am working on a particle & particle emitter class, but I have a question about passing around the LPDIRECT3DDEVICE9. This is a pointer to the device and I declare one in my main cpp file
LPDIRECT3DDEVICE9 d3dDevice;
In my Particle class that I have written, I have to at points use the device. For example, I must load the texture
D3DXCreateTextureFromFile(device,textureFileName,&texture);
I digress... I have created a second LPDIRECT3DDEVICE9 in the scope of my Particle class. Then in the constructor I do this:
Particle(LPDIRECT3DDEVICE9* device, ...){ d3dDevice = device; ...}
The method call being
Particle particle[PARTICLECOUNT];for(int i = 0; i < PARTICLECOUNT; i++){ particle = Particle(&d3dDevice, ...);}
In effect I have a pointer to a pointer. Is this necessary or am I going a step too far with this? FYI it works with this method, but I am worried that I am creating unessential overhead?