Ejemplo n.º 1
0
SampleManager :: SampleManager(void) {
	_reset();
}
Ejemplo n.º 2
0
void SampleManager :: DelAll(void) {
	_destroy();
	_reset();
}
Ejemplo n.º 3
0
int TextureManager :: Load(const Settings& sets,const string& root) {
	if( ! sets.isValid() ) {
		ERROR("Obiekt opisujący tekstury jest nieważny");
		return -2;
	}

	Settings s, s1;
	int n, li_ret;
	string id, pid, file_name;
	PTex *pt;
	LTex *lt;
	int ix1, ix2, iy1, iy2, ihsx, ihsy;
	double fhsx, fhsy;

	//usuwamy wszystko
	_destroy();
	_reset();

	//ladujemy tekstury fizyczne
	if( root != "" )
		s = sets.Extract(root + ".Phisical");
	else
		s = sets.Extract(root + "Phisical");
	if( ! s.isValid() ) {
		ERROR("Blad pobierania danych na temat tekstur fizycznych: " + s.ErrorMsg() );
		return -3;
	}
	INFO(s.Dump());

	//TODO - dorobic pobieranie ilosci wpisow o tekturach
	n = 1;
	s1 = s.Extract("Phisical["+toString(n)+"]");
	while( s1.isValid() ) {
		INFO("texture<" + toString(n) + ">");
		INFO(s1.Dump());

		id = s1.GetValS("Phisical.ID");
		file_name = s1.GetValS("Phisical.FileName");
		INFO("plik: " + id + " : " + file_name);

		pt = new PTex();
		li_ret = pt->Load(file_name);
		if( li_ret < 0 ) {
			delete pt;
			ERROR("Error loading the texture file (filename=" + file_name + ") !" );
			return -4;
		}

		AddPTex(id,pt);
		INFO("Dodano teksture o id=" + id );

		n++;
		s1 = s.Extract("Phisical["+toString(n)+"]");
	}
	INFO("Error: " + s1.ErrorMsg() );

	//ladujemy tekstury logiczne
	if( root != "" )
		s = sets.Extract(root + ".Logical");
	else
		s = sets.Extract(root + "Logical");
	if( ! s.isValid() ) {
		ERROR("Blad pobierania danych na temat tekstur logicznych: " + s.ErrorMsg() );
		return -4;
	}
	INFO( s.Dump() );

	//TODO - dorobic pobieranie ilosci wpisow o tekturach
	n = 1;
	s1 = s.Extract("Logical["+toString(n)+"]");
	while( s1.isValid() ) {
		INFO( "texture<" + toString(n) + ">" );
		INFO( s1.Dump() );

		id = s1.GetValS("Logical.ID");
		pid = s1.GetValS("Logical.PID");
		ix1 = s1.GetValI("Logical.Pos",0);
		iy1 = s1.GetValI("Logical.Pos",1);
		ix2 = s1.GetValI("Logical.Pos",2);
		iy2 = s1.GetValI("Logical.Pos",3);
		if( ix2 < 0 ) ix2 = ix1 - ix2;
		if( iy2 < 0 ) iy2 = iy1 - iy2;

		if( s1.IsValF("Logical.HotSpot") ) {
			fhsx = s1.GetValF("Logical.HotSpot",0);
			fhsy = s1.GetValF("Logical.HotSpot",1);
		} else {
			ihsx = s1.GetValI("Logical.HotSpot",0);
			ihsy = s1.GetValI("Logical.HotSpot",1);
			fhsx = ((GLfloat)(ihsx - ix1))/(ix2-ix1);
			fhsy = ((GLfloat)(ihsy - iy1))/(iy2-iy1);
		}


		pt = GetPTex(pid);
		if( 0 == pt ) {
			ERROR("Brak tekstury fizycznej o ID=\"" + pid + "\". Tekstura logiczna o ID=\"" + id + "\" nie może być utworzona !!!");
		} else {
			lt = new LTex();
			lt->Set(pt,ix1,iy1,ix2,iy2);
			lt->SetHotSpot( fhsx, fhsy );
			AddLTex(id,lt);
			INFO( "Dodano teksture o id=" + id );
		}

		n++;
		s1 = s.Extract("Logical["+toString(n)+"]");
	}
	INFO("Error: " + s1.ErrorMsg());

	INFO("End of textures");

	return 1;
}
Ejemplo n.º 4
0
PTex :: PTex(const PTex& tex) {
	_reset();
	texnum = tex.texnum;
	w = tex.w;
	h = tex.h;
}
Ejemplo n.º 5
0
PTex :: PTex(const string& name) {
	_reset();
	Load(name);
}
Ejemplo n.º 6
0
void TextureManager :: DelAll(void) {
	_destroy();
	_reset();
}
Ejemplo n.º 7
0
TextureManager :: TextureManager(void) {
	_reset();
}
Ejemplo n.º 8
0
 virtual ~CType() { _reset() ; }
Ejemplo n.º 9
0
LTex :: LTex( const PTex* tex, int x1, int y1, int x2, int y2 ) {
	_reset();
	Set(tex,x1,y1,x2,y2);
}
Ejemplo n.º 10
0
LTex :: LTex( const PTex* tex, float x1, float y1, float x2, float y2 ) {
	_reset();
	Set(tex,x1,y1,x2,y2);
}
Ejemplo n.º 11
0
LTex :: LTex( const PTex* tex ) {
	_reset();
	Set(tex);
}
Ejemplo n.º 12
0
LTex :: LTex(void) {
	_reset();
}
Ejemplo n.º 13
0
 virtual void reset(void) { _reset(); }
Ejemplo n.º 14
0
int SampleManager :: Load(const Settings& sets,const string& root) {
	if( ! sets.isValid() ) {
		ERROR("Obiekt opisuj¹cy sample jest niewa¿ny");
		return -2;
	}

	Settings s, s1;
	int n, li_ret;
	string id, pid, file_name;
	PSam *pt;
	LSam *lt;
	int ioffset, ilen;

	//usuwamy wszystko
	_destroy();
	_reset();

	//ladujemy sample fizyczne
	if( root != "" )
		s = sets.Extract(root + ".Phisical");
	else
		s = sets.Extract(root + "Phisical");
	if( ! s.isValid() ) {
		ERROR("Blad pobierania danych na temat sampli fizycznych: " + s.ErrorMsg() );
		return -3;
	}
	INFO(s.Dump());

	//TODO - dorobic pobieranie ilosci wpisow o samplach
	n = 1;
	s1 = s.Extract("Phisical["+toString(n)+"]");
	while( s1.isValid() ) {
		INFO("sample<" + toString(n) + ">");
		INFO(s1.Dump());

		id = s1.GetValS("Phisical.ID");
		file_name = s1.GetValS("Phisical.FileName");
		INFO("plik: " + id + " : " + file_name);

		pt = new PSam();
		li_ret = pt->Load(file_name);
		if( li_ret < 0 ) {
			delete pt;
			ERROR("Error loading the sample file (filename=" + file_name + ") !" );
			return -4;
		}

		AddPSam(id,pt);
		INFO("Dodano sampel o id=" + id);

		n++;
		s1 = s.Extract("Phisical["+toString(n)+"]");
	}
	INFO("Blad: " + s1.ErrorMsg());

	//ladujemy sample logiczne
	if( root != "" )
		s = sets.Extract(root + ".Logical");
	else
		s = sets.Extract(root + "Logical");
	if( ! s.isValid() ) {
		ERROR("Blad pobierania danych na temat sampli logicznych: " + s.ErrorMsg() );
		return -4;
	}
	INFO(s.Dump());

	//TODO - dorobic pobieranie ilosci wpisow o tekturach
	n = 1;
	s1 = s.Extract("Logical["+toString(n)+"]");
	while( s1.isValid() ) {
		INFO("sampel<" + toString(n) + ">");
		INFO(s1.Dump());

		id = s1.GetValS("Logical.ID");
		pid = s1.GetValS("Logical.PID");
		ioffset = s1.GetValI("Logical.Offset");
		ilen = s1.GetValI("Logical.Length");

		pt = GetPSam(pid);
		if( 0 == pt ) {
			ERROR("Brak sampla fizycznego o ID=\"" + pid + "\". Sampel logiczny o ID=\"" + id + "\" nie mo¿e byæ utworzony !!!");
		} else {
			lt = new LSam();
			lt->Set(pt,ioffset,ilen);
			AddLSam(id,lt);
			INFO("Dodano sampel o id=" + id);
		}

		n++;
		s1 = s.Extract("Logical["+toString(n)+"]");
	}
	INFO("Blad: " + s1.ErrorMsg());


	INFO("Koniec sampli");

	return 1;
}
Ejemplo n.º 15
0
PTex :: PTex(void) {
	_reset();
}
Ejemplo n.º 16
0
LSam :: LSam(void) {
	_reset();
}
Ejemplo n.º 17
0
int restart_cmd(int argc, char *argv[]) {
	_reset();
}