editordata: use tex_load to load the heightmap - don't need the ogl_tex functionality and this avoids the POT check (which would fail)

ogl_tex: remove POT-check-avoidance hack

This was SVN commit r3166.
This commit is contained in:
janwas 2005-11-20 14:35:52 +00:00
parent b417951ef8
commit 9be309d4c7
2 changed files with 50 additions and 56 deletions

View File

@ -446,10 +446,8 @@ static int OglTex_validate(const OglTex* ot)
// note: we can't work around this because both NV_texture_rectangle
// and subtexture require work for the client (changing tex coords).
// TODO: ARB_texture_non_power_of_two
#ifndef SCED // HACK: ScEd needs to load a 321x321 PNG (as a heightmap, not uploaded to OpenGL)
if(!is_pow2(w) || !is_pow2(h))
return -102;
#endif
// texture state
if(!filter_valid(ot->state.filter))

View File

@ -529,21 +529,17 @@ void CEditorData::OnDraw()
bool CEditorData::LoadTerrain(const char* filename)
{
Handle h = ogl_tex_load(filename);
if(h<=0) {
Tex t;
if(tex_load(filename, &t) < 0)
{
char buf[1024];
sprintf(buf,"Failed to load \"%s\"",filename);
ErrorBox(buf);
return false;
} else {
}
uint width=0;
uint height=0;
uint bpp=0;
void *ptr=0;
(void)ogl_tex_get_size(h, &width, &height, &bpp);
(void)ogl_tex_get_data(h, &ptr);
uint width=t.w, height=t.h, bpp=t.bpp;
void *ptr=tex_get_data(&t);
// rescale the texture to fit to the nearest of the 4 possible map sizes
u32 mapsize=9; // assume smallest map
@ -581,12 +577,12 @@ bool CEditorData::LoadTerrain(const char* filename)
// clean up
delete[] data;
delete[] heightmap;
(void)tex_free(&t);
// re-initialise minimap - terrain size may have changed
g_MiniMap.Initialise();
return true;
}
}
// UpdateWorld: update time dependent data in the world to account for changes over