Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix D3D9 Lighting Material #1530
This pull request fixes some Direct3D9 rendering regressions for Project Mario. The specific problem is that vertices that do not have color data are not being rendered when lighting is enabled. Most of the models in Project Mario do not have color or alpha data, but do have texture and normal coordinates.
As is probably obvious, this is not the case with our OpenGL systems or classic GM where the vertices would be simply drawn opaque black. The problem stems from the fact that Direct3D9 uses a default material that's black and transparent where the 0 alpha of the default material cancels out the texel color of the vertex. To help clarify, you can think of the material as D3D's analog to glColor from OpenGL, but for lighting.
I likely introduced this regression in #1395 when I removed similar code originally added by me in c1b8ef1 that was setting a custom material when defining point lights. That way still had a problem because it is actually more correct and cleaner to only set the material once at startup so it affects all types of lights and because there is no need to change it. The cause of the confusion was that apitrace does not show you what the current material state is anywhere I could see it.