#include <lighting_control_tests.h>
Public Member Functions | |
LightingControlTests (TestHost &host, std::string output_dir, const Config &config) | |
void | Deinitialize () override |
Called to tear down the test suite. | |
void | Initialize () override |
Called to initialize the test suite. | |
![]() | |
TestSuite (TestHost &host, std::string output_dir, std::string suite_name, const Config &config) | |
const std::string & | Name () const |
virtual void | SetupTest () |
Called before running an individual test within this suite. | |
virtual void | TearDownTest () |
Called after running an individual test within this suite. | |
void | DisableTests (const std::set< std::string > &tests_to_skip) |
std::vector< std::string > | TestNames () const |
bool | HasEnabledTests () const |
void | Run (const std::string &test_name) |
void | RunAll () |
void | SetSavingAllowed (bool enable=true) |
Additional Inherited Members | |
![]() | |
static void | TagNV2ATrace (uint32_t num_nops) |
Inserts a pattern of NV097_NO_OPERATION's into the pushbuffer to allow identification when viewing nv2a traces. | |
![]() | |
void | SetDefaultTextureFormat () const |
![]() | |
TestHost & | host_ |
std::string | output_dir_ |
std::string | suite_name_ |
bool | allow_saving_ {true} |
std::map< std::string, std::function< void()> > | tests_ {} |
PGRAPHDiffToken | pgraph_diff_ |
bool | enable_progress_log_ |
bool | enable_pgraph_region_diff_ |
uint32_t | delay_milliseconds_between_tests_ |
std::shared_ptr< FTPLogger > | ftp_logger_ |
Tests the effects of NV097_SET_LIGHT_CONTROL (0x294) in conjunction with NV097_SET_SPECULAR_ENABLE.
A number of test meshes are rendered and lit with two lights:
1) A directional light coming from the left and pointing into the screen (direction is {1, 0, 1}).
2) An attenuated point light on the right at {1.5f, 1.f, -2.5f} with a max rannge of 4. and attenuation of {0.025f, 0.15f, 0.02f}.
Both lights have ambient {0.f, 0.f, 0.05f}, diffuse {0.25f, 0.f, 0.f}, specular {0.f, 0.2f, 0.4f}.
Meshes have the specular color of each vertex at {0.f, 0.4, 0.f, 0.25f}.
All colors are taken from the material (i.e., contributed by the lights). NV097_SET_MATERIAL_ALPHA is set to 0.4 and the scene ambient is a very dark grey at 0.031373.
See also: the OpenGL 2.1 specification lighting model https://registry.khronos.org/OpenGL/specs/gl/glspec21.pdf
Notes on use with the programmable pipeline:
While it is possible to enable lights when using a vertex shader, it appears that parts of the pipeline are not fully initialized, leading to non-deterministic color effects that change with each draw and often differ across cold boots of the hardware.
Leaving lighting enabled without enabling any lights via NV097_SET_LIGHT_ENABLE_MASK will cause all vertices to be black in color, but alpha will still come from the material when allowed by the light control and specular enable settings.
Disabling specular with lighting enabled will still disable the alpha application.
Enabling specular with lighting disabled will apply the material alpha and use the vertex shader output colors.
LightingControlTests::LightingControlTests | ( | TestHost & | host, |
std::string | output_dir, | ||
const Config & | config | ||
) |
|
overridevirtual |
Called to tear down the test suite.
Reimplemented from TestSuite.
|
overridevirtual |
Called to initialize the test suite.
Reimplemented from TestSuite.