|
From: Peter M. <Pet...@mi...> - 2004-10-08 17:11:23
|
Hi All,
After testing I have found a crashing bug that we did not have before.
It looks to be with files that claim to have textures but do not actual
have any texture data when asked to supply them.
I have a fix, in E3Shader.c but it is not pretty.
The question is should we have this kind of checks elsewhere when
creating instanceData?
Or is there a problem in my code that allows this problem in the first
place?
If you would like a copy of the file I can place it on ftp.( it is a
sample 3DMF file from apple called "57 Chevy" ). I did not have any
problems opening the file in geomtest.
Thanks for any pointer on this issus,
Peter.
Fix.....
//
========================================================================
=====
// E3TextureShader_GetTexture : Get the texture shader's texture
object.
/
/-----------------------------------------------------------------------
------
TQ3Status
E3TextureShader_GetTexture(TQ3ShaderObject shader, TQ3TextureObject
*texture)
{ TQ3TextureObject *instanceData = (TQ3TextureObject *)
E3ClassTree_FindInstanceData(shader, kQ3SurfaceShaderTypeTexture);
if ( instanceData )
{ // Create a new reference to our renderer
E3Shared_Acquire(texture, *instanceData);
return(kQ3Success);
}
return(kQ3Failure);
}
//
========================================================================
=====
// E3TextureShader_SetTexture : Set a texture shader's texture.
/
/-----------------------------------------------------------------------
------
TQ3Status
E3TextureShader_SetTexture(TQ3ShaderObject shader, TQ3TextureObject
texture)
{ TQ3TextureObject *instanceData = (TQ3TextureObject *)
E3ClassTree_FindInstanceData(shader, kQ3SurfaceShaderTypeTexture);
if ( instanceData )
{ // Replace the existing texture reference
E3Shared_Replace(instanceData, texture);
Q3Shared_Edited(shader);
return(kQ3Success);
}
return(kQ3Failure);
}
|