36 using namespace VSFileSystem;
92 setReference( oldtex );
108 oldtex->palette = NULL;
132 original->original = NULL;
133 original->refcount++;
158 if (retval->
name != -1) {
174 setbad( texfilename );
177 if (original != NULL) {
202 bool *
b =
new bool(
true);
216 ismipmapped = mipmap;
218 texture_target = target;
219 image_target = imagetarget;
236 ismipmapped = mipmap;
239 texture_target = target;
240 image_target = imagetarget;
242 data = this->ReadImage( f, NULL,
true, NULL );
244 if (mode >= _DXT1 && mode <= _DXT5) {
245 if ( (
int) data[0] == 0 ) {
251 Bind( main, maxdimension, detailtexture );
253 Bind( maxdimension, detailtexture );
256 if (!nocache) setold();
275 Load( FileName, stage, mipmap, target, imagetarget, force_load, maxdimension, detailtexture, nocache, address_mode, main );
290 if (data) free( data );
291 if (palette) free( palette );
294 ismipmapped = mipmap;
295 texture_target = target;
296 image_target = imagetarget;
298 this->address_mode = address_mode;
299 string texfn = string( FileName );
300 if ( checkbad( texfn ) )
304 if ( checkold( texfn,
false, tempstr )
305 || checkold( texfn,
true, tempstr ) ) {
306 texfilename = tempstr;
311 char *t = strdup( FileName );
312 int tmp = strlen( FileName );
340 bool shared = (err ==
Shared);
355 modold( texfn, shared, tempstr );
356 texfilename = tempstr;
358 if (texfn.find(
"white" ) == string::npos)
362 data = this->ReadImage( &f, NULL,
true, NULL );
364 data = this->ReadImage( &f, NULL,
true, &f2 );
366 if (mode >= _DXT1 && mode <= _DXT5) {
367 if ( (
int) data[0] == 0 ) {
373 Bind( main, maxdimension, detailtexture );
375 Bind( maxdimension, detailtexture );
378 if (!nocache) setold();
389 const char *FileNameA,
421 const char *FileNameA,
435 if (data) free( data );
436 if (palette) free( palette );
439 ismipmapped = mipmap;
442 this->address_mode = address_mode;
443 texture_target = target;
444 image_target = imagetarget;
445 string texfn = string( FileNameRGB )+string(
"|" )+string( FileNameA );
448 if ( checkold( texfn,
false, tempstr )
449 || checkold( texfn,
true, tempstr ) ) {
450 texfilename = tempstr;
461 bool shared = (err ==
Shared);
463 modold( texfn, shared, tempstr );
464 texfilename = tempstr;
478 static bool use_alphamap =
486 shared1 = (err1 ==
Shared);
491 }
else {FileNameA = 0; }}
493 data = this->ReadImage( &f, NULL,
true, NULL );
495 data = this->ReadImage( &f, NULL,
true, &f1 );
497 if (mode >= _DXT1 && mode <= _DXT5) {
498 if ( (
int) data[0] == 0 ) {
504 Bind( main, maxdimension, detailtexture );
506 Bind( maxdimension, detailtexture );
509 if (!nocache) setold();
521 if (original == NULL) {
531 if (palette != NULL) {
536 original->refcount--;
537 if (original->refcount == 0)
578 internformat =
RGB24;
586 if (img_sides == SIDE_SINGLE) {
587 GFXTransferTexture( data, name, sizeX, sizeY, internformat, image_target, maxdimension, detailtexture );
600 if ( !bound || (boundSizeX != sizeX) || (boundSizeY != sizeY) || (boundMode != mode) ) {
605 GFXCreateTexture( sizeX, sizeY,
DXT1, &name, NULL, stage, ismipmapped, texture_target, address_mode );
612 GFXCreateTexture( sizeX, sizeY,
DXT3, &name, NULL, stage, ismipmapped, texture_target, address_mode );
615 GFXCreateTexture( sizeX, sizeY,
DXT5, &name, NULL, stage, ismipmapped, texture_target, address_mode );
625 GFXCreateTexture( sizeX, sizeY,
RGB24, &name, NULL, stage, ismipmapped, texture_target, address_mode );
628 GFXCreateTexture( sizeX, sizeY,
PALETTE8, &name, (
char*) palette, stage, ismipmapped, texture_target, address_mode );
636 Transfer( maxdimension, detailtexture );
647 bound = other->
bound;
649 Transfer( maxdimension, detailtexture );
667 static bool missing =
false;
668 if ( (name == -1) || (pass != 0) ) {
675 switch (texture_target)
679 #ifdef GL_EXT_texture3D
687 address_mode =
CLAMP;