Add lighting

This commit is contained in:
2026-11-20 12:12:50 +01:00
parent 491367dfa8
commit 7aad3c6292
6 changed files with 60 additions and 15 deletions
+16 -5
View File
@@ -1,7 +1,7 @@
#pragma once
#include <d3d9.h>
#define FVF D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1
#define FVF D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_NORMAL
struct Vertex
{
@@ -10,6 +10,11 @@ struct Vertex
float y;
float z;
// normal
float nx;
float ny;
float nz;
// color
D3DCOLOR color;
@@ -17,8 +22,14 @@ struct Vertex
float u;
float v;
Vertex() : x(0.0f), y(0.0f), z(0.0f), color(0xffffffff), u(0.0f), v(0.0f) {}
Vertex(float x, float y, float z) : x(x), y(y), z(z), color(0xffffffff), u(0.0f), v(0.0f) {}
Vertex(float x, float y, float z, UINT r, UINT g, UINT b) : x(x), y(y), z(z), color(D3DCOLOR_XRGB(r, g, b)), u(0.0f), v(0.0f) {}
Vertex(float x, float y, float z, float u, float v) : x(x), y(y), z(z), color(0xffffffff), u(u), v(v) {}
Vertex() : x(0.0f), y(0.0f), z(0.0f), color(0xffffffff), u(0.0f), v(0.0f), nx(0.0f), ny(0.0f), nz(0.0f) {}
Vertex(float x, float y, float z) : x(x), y(y), z(z), color(0xffffffff), u(0.0f), v(0.0f), nx(0.0f), ny(0.0f), nz(0.0f) {}
Vertex(float x, float y, float z, UINT r, UINT g, UINT b) :
x(x), y(y), z(z), color(D3DCOLOR_XRGB(r, g, b)), u(0.0f), v(0.0f), nx(0.0f), ny(0.0f), nz(0.0f) {}
Vertex(float x, float y, float z, float u, float v) :
x(x), y(y), z(z), color(0xffffffff), u(u), v(v), nx(0.0f), ny(0.0f), nz(0.0f) {}
Vertex(float x, float y, float z, float nx, float ny, float nz, float u, float v) :
x(x), y(y), z(z), color(0xffffffff), u(u), v(v), nx(nx), ny(ny), nz(nz) {}
};