Anyway, here's my code for the first header:
#ifndef SceneClassDefined
#define SceneClassDefined
#include "D3DSysClass.h"
#include "GPUConstantBufferClass.h"
#include "SphereClass.h"
struct SceneInfoStruct
{
float MaxViewDistance;
int NumObjectTypes;
int NumSpheres;
float Filler1;
};
class SceneClass
{
public:
SceneClass(SceneInfoStruct * pSceneInfoPassed, D3DSysClass * pD3DSysPassed);
~SceneClass();
void AddSphere(SphereInfoStruct * pSphereInfo);
private:
SceneInfoStruct * pSceneInfo;
GPUConstantBufferClass * pSceneInfoBuff;
D3DSysClass * pD3DSys;
std::vector<SphereInfoStruct> * pSpheres;
};
#endif //SceneClassDefined
And here is the code for the second shader:
#ifndef SphereClassDefined
#define SphereClassDefined
#include "SceneClass.h"
struct SphereInfoStruct
{
float Center[3];
float Radius;
};
class SphereClass
{
public:
SphereClass(SphereInfoStruct * pSphereInfoPassed, SceneClass *pScenePassed);
private:
SphereInfoStruct * pSphereInfo;
SceneClass * pScene;
};
#endif //SphereClassDefined
The issue is that every time I create a Sphere I want its constructor to automatically call Scene::AddSphere() , but sequentiality of definition makes my solution impossible. How would you implement this? I assume there's a standard way of dealing with this kind of thing?