From: Jonathan C Bodner (bodner++at++cmf.nrl.navy.mil)
Date: 06/07/2002 07:52:06
Hi,
I sent a message yesterday asking for the proper way to change the function
used to resolve the file name for a cliptexture image tile. I didn't get a
response, so I poked around a bit more. Since my last message, I started
modifying clipdemo in an attempt to try to get this to work. So far, nothing
is working, and I think there's a bug in Performer that's the source of my
problems.
I modified dbase.C as follows:
pfGroup *MakeClipDbase(char *fname, float download_time)
{
int i, j;
printf("###### Loading Clip texture %s\n", fname);
Shared->clptex = pfdLoadClipTexture(fname);
if(!Shared->clptex)
return(NULL);
/*JCB 06/06/02 Put in test function to do loading of clip textures */
insertFileNameFunc(Shared->clptex);
/*JCB 06/06/02 End test function*/
<rest of function follows unchanged>
}
/* JCB 06/06/02 New Function */
void insertFileNameFunc(pfClipTexture* clipTexture)
{
int numLevels = clipTexture->getNumClippedLevels();
printf("numLevels == %d\n",numLevels);
printf("image cache type == %s\n", pfImageCache::getClassType()->getName());
printf("image tile type == %s\n", pfImageTile::getClassType()->getName());
for(int i =0;i<numLevels;i++) {
pfObject* obj = clipTexture->getLevel(i);
if(obj == NULL) {
printf("obj is null\n");
}
if(obj->isOfType(pfImageCache::getClassType())) {
printf("level %d is an image cache\n",i);
manageImageCache2((pfImageCache*)obj);
} else if(obj->isOfType(pfImageTile::getClassType())) {
printf("level %d is an image tile\n",i);
pfImageTile* tile = (pfImageTile*)obj;
tile->setFileNameFunc(jonFileNameFunc);
} else {
printf("I have no idea what level %d is\n",i);
}
}
}
void jonFileNameFunc(pfImageTile *_itile) {
printf("This is the file name function written by jon!\n");
pfImageCache::autoConfigFileName(_itile);
}
void manageImageCache(pfImageCache* cache) {
cache->setTileFileNameFunc(jonFileNameFunc);
}
void manageImageCache2(pfImageCache* cache) {
int s, t, r;
cache->getTexRegionSize(&s,&t,&r);
printf("s == %d\nt == %d\nr == %d\n",s,t,r);
for(int i = 0;i<s;i++) {
for(int j =0;j<t;j++) {
for(int k = 0;k<r;k++) {
pfImageTile* tile = cache->getTile(i,j,k);
tile->setFileNameFunc(jonFileNameFunc);
}
}
}
cache->setTileFileNameFunc(jonFileNameFunc);
}
All I'm expecting to see is a print statement whenever an image tile is loaded
from disk. What happens is I get no feedback when I use the manageImageCache
method, and when I use manageImageCache2, I get the following error message
for every single image tile in every image cache:
PF Warning: Attempt to get cache tile that isn't resident -
Clearly, the pfImageCache::setTileFileNameFunc is broken. And there doesn't
seem to be a way to use pfImageTile::setFileNameFunc before the tile data is
already loaded.
What should I do?
Thanks,
-jon
This archive was generated by hypermail 2b29 : Fri Jun 07 2002 - 07:52:26 PDT