FTE CSQC RAWIMAGES
From Quake Wiki
noref void(string rendererdescription) CSQC_RendererRestarted; int*(string filename, __out int width, __out int height) r_readimage = #0; void(string imagename, int width, int height, void *pixeldata, optional int datasize, optional int pixelformat) r_uploadimage = #0;
The r_readimage function allows you to read an rgba image into memory (as a packed series of 32bit ints). Returns __NULL__ if the file couldn't be opened or if the format wasn't supported. You must memfree the result once you're done with it. It is not expected to be available in dedicated servers. Note that the lack of threading means that you should not use this function unless you actually need raw image access. You should not attempt to use this on compressed formats (ie: dds or ktx files) as the only way to satisfy such a request would be to decompress the data first.
The r_uploadimage function allows you to then send that data to the client's renderer. The resulting image is an image, and NOT a shader. Normally when naming a shader, an image will be implicitly loaded, however when the image does not exist yet then that shader cannot be generated properly. This results in a race condition between the upload and when the shader is first precached/used. If your shader uses a line such as "map $rt:MYIMAGENAME" then the shader and texture can be created in either order. This may require the use of the shaderforname builtin. All textures will be PURGED by on video restarts. You can detect when this happens with the CSQC_RendererRestarted function, and re-upload any textures.
|0|| Automatic - The data will be decoded as if it were a tga/etc (engine-willing) according to a file header.
Combine with infoblobs and binary file access in order to network custom avatars, or something.
|1(default)||RGBA32UB - packed rgba data compatible with r_readimage. One 32bit int per pixel.|
|2||RGBA16F - Half-float data, not that qc can actually generate such data.|
|3||RGBA32F - Float data, each pixel will take 4 separate floats per pixel (128bpp).|