Есть такой класс
//#include "FileReader.h"
struct Image
{
float**TextureCoordinats;
float**VertexCoordinats;
unsigned int*IndexTexture;
std::string *Name;
int *number;
};
class Scene1
{
public:
Scene1(void);
void LoadImage(const ILstring path);
void ShowWelcome(bool show);
void EnableTexture(float*texcoor, float*vercoor);
int FindTexture(std::string name);
~Scene1();
unsigned char*copyData;
static const int CountTexture = 53;//40
Image *image;
int CountIndexTexture;
};
и есть метод
void Scene1::LoadImage(const ILstring path)
{
...
copyData = ilGetData();
...
glGenTextures(1, &image->IndexTexture[CountIndexTexture]);
...
glBindTexture(GL_TEXTURE_2D, image->IndexTexture[CountIndexTexture]);
...
gluBuild2DMipmaps(GL_TEXTURE_2D, type, width, height, type, GL_UNSIGNED_BYTE, copyData);
...
CountIndexTexture++;
};
нужно для класса сцены получить данные из этого метода который я планирую поместить в другой класс FileReader, как передать данные из класса FileReader в class Scene? Данные copyData или даже image, для простоты вот набросок
#include "FileReader.h"
class Scene
{
...
FileReader*filereader;
...
}
void Scene1::ShowWelcome(bool show)
{
...
int numb = FindTexture("welcome",filereader->getimagetexture());
glBindTexture(GL_TEXTURE_2D, filereader->getimagetexture(IndexTexture[numb]));
EnableTexture(filereader->getimagetexturecoordinats(TextureCoordinats[numb]), filereader->getimagevertexcoordinats(VertexCoordinats[numb]);
...
}
А LoadImage() и прочие свойства закинуть в FileReader
class FileReader
{
...
LoadImage(const ILstring path);
unsigned char*copyData;
...
}
void FileReader::LoadImage(const ILstring path)
{
...
copyData = ilGetData();
...
glGenTextures(1, &image->IndexTexture[CountIndexTexture]);
...
glBindTexture(GL_TEXTURE_2D, image->IndexTexture[CountIndexTexture]);
...
gluBuild2DMipmaps(GL_TEXTURE_2D, type, width, height, type, GL_UNSIGNED_BYTE, copyData);
...
CountIndexTexture++;
};
, или можно как-то иначе?