#include "texconversion.h"
#include "polyflags.h"
Defines | |
#define | PF_Transient PF_Highlighted |
The game has two types of textures: static ones and dynamic. Dynamic texures are parametric ones such as water, etc. After trying multiple methods, it was determined best to create static textures as USAGE_IMMUTABLE, and dynamic ones as USAGE_DEFAULT (i.e. not USAGE_DYNAMIC). USAGE_DEFAULT textures cannot be mapped, but they are updated using a copy operation. A nice thing about this is that it allows the texture handling to be streamlined; it used to have seperate paths for map()-able and immutable textures. However copy-able and immutable textures can be handled about the same way as they both are created from initial data, instead of being filled after their creation.
Some texture types can be used by D3D without conversion; depending on the type (see formats array below) direct assignments can take place.
New textures are created by having the D3D class create a texture out of their converted/assigned mips stored as D3D_SUBRESOURCE_DATA; the texture conversion function sets the TEXTURE_2D_DESC parameters for this depending on the texture size, if it is dynamic, etc. Existing textures are updated by passing a new mip to the D3D class; only the 0th mip is updated, which should be fine (afaik there's no dynamic textures with >1 mips).
Texture conversion functions write to a void pointer so they can work unmodified regardless of the underlying memory.
Additional notes: