I am having difficulties to understand what is going on in
PT(Texture) TexturePool::
make_texture(const string &extension) const {
Texture::make_texture
MakeTextureFunc *func = get_texture_type(extension);
if (func != NULL) {
return func();
}
// We don't know what kind of file type this is; return an ordinary
// Texture in case it's an image file with no extension.
return new Texture;
}
If the type is known then:
get_texture_type(extension)
returns a function pointer to:
PT(Texture) Texture::
make_texture() {
return new Texture;
}
otherwise it returns NULL and subsequently PT(Texture) TexturePool::make_texture(const string &extension) returns new Texture
Yes, in the case of an ordinary texture, it’s the same thing. But in the case of a video texture extension, like .avi or something, then get_texture_type() will return a pointer to the constructor for the appropriate video texture class.