wowserhq / wowser

World of Warcraft in the browser using JavaScript and WebGL
MIT License
239 stars 63 forks source link

Implement runtime M2 shader_id calculation logic matching Wrath of the Lich King #132

Open fallenoak opened 8 years ago

fallenoak commented 8 years ago

The Wrath of the Lich King (and potentially earlier game versions) game client does not simply select shaders for M2s based on the shader_id value present in the on-disk .skin files. Rather, it's determined at runtime based on a combination of blending mode, render flags, texture mapping, transparency animations, and etc.

The resulting value for shader_id, a masked integer, is then checked to select the appropriate string for vertex and pixel shaders.

To get M2s to render properly, we should implement the same shader_id calculation and shader selection logic as the official game client.

fallenoak commented 8 years ago

The shader_id calculation logic can live in the new BatchManager class.