Adds tests for int16 normals.

This commit is contained in:
Erik Abair 2022-01-24 17:22:56 -08:00
parent 104b25f69b
commit 09d02f157a
4 changed files with 27 additions and 1 deletions

View File

@ -126,6 +126,7 @@
#define NV097_SET_WEIGHT1F 0x169C
#define NV097_SET_WEIGHT4F 0x16C0
#define NV097_SET_NORMAL3F 0x1530
#define NV097_SET_NORMAL3S 0x1540
#define NV097_SET_DIFFUSE_COLOR4F 0x1550
#define NV097_SET_DIFFUSE_COLOR 0x156C
#define NV097_SET_SPECULAR_COLOR4F 0x1570

View File

@ -521,6 +521,14 @@ void TestHost::SetNormal(float x, float y, float z) const {
pb_end(p);
}
void TestHost::SetNormal3S(int x, int y, int z) const {
auto p = pb_begin();
uint32_t xy = (x & 0xFFFF) | y << 16;
uint32_t z0 = z & 0xFFFF;
p = pb_push2(p, NV097_SET_NORMAL3S, xy, z0);
pb_end(p);
}
void TestHost::SetDiffuse(float r, float g, float b, float a) const {
auto p = pb_begin();
p = pb_push4f(p, NV097_SET_DIFFUSE_COLOR4F, r, g, b, a);

View File

@ -130,6 +130,7 @@ class TestHost {
void SetWeight(float w) const;
void SetWeight(float w1, float w2, float w3, float w4) const;
void SetNormal(float x, float y, float z) const;
void SetNormal3S(int x, int y, int z) const;
void SetDiffuse(float r, float g, float b, float a) const;
void SetSpecular(float r, float g, float b, float a) const;
void SetFogCoord(float fc) const;

View File

@ -133,7 +133,23 @@ void AttributeExplicitSetterTests::Test() {
};
DO_DRAW(set_normal_3f, ATTR_NORMAL);
// set_normal_3i
auto set_normal_3s = [this](int index) {
switch (index) {
default:
case 0:
host_.SetNormal3S(0x7FFF, 0, 0);
break;
case 1:
host_.SetNormal3S(0, 0x7FFF, 0);
break;
case 2:
host_.SetNormal3S(0, 0, 0x7FFF);
break;
}
};
DO_DRAW(set_normal_3s, ATTR_NORMAL);
auto set_diffuse_4f = [this](int index) {
switch (index) {